Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add internal endpoints for sessions and expose backend #2083

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

MoritzWeber0
Copy link
Member

@MoritzWeber0 MoritzWeber0 commented Dec 11, 2024

The internal endpoints can be received via the API for inter-session communication.

A new network route is available between sessions and the backend. This enables sessions to use the backend API.

Two new pre-defined variables were added:

  • CAPELLACOLLAB_API_BASE_URL
  • CAPELLACOLLAB_SESSION_REQUESTER_USER_ID

This enables sessions to talk to other sessions more easily. For example, this is a small script to send a request to another session. The personal access token has to be replaced manually (until #1774 is implemeted).

import os
import requests

backend_url = os.getenv("CAPELLACOLLAB_API_BASE_URL")
user_id = os.getenv("CAPELLACOLLAB_SESSION_REQUESTER_USER_ID")
username = os.getenv("CAPELLACOLLAB_SESSION_REQUESTER_USERNAME")

response = requests.get(f"{backend_url}/v1/users/{user_id}/sessions", auth=(username, "ENTER_YOUR_PAT_HERE"))

internal_endpoint = response.json()[0]["internal_endpoint"]
requests.get(f"http://{internal_endpoint}").content

@MoritzWeber0 MoritzWeber0 requested a review from zusorio December 11, 2024 13:39
@MoritzWeber0 MoritzWeber0 linked an issue Dec 11, 2024 that may be closed by this pull request
Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.53%. Comparing base (c78b955) to head (e51298e).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2083      +/-   ##
==========================================
+ Coverage   85.50%   85.53%   +0.02%     
==========================================
  Files         224      224              
  Lines        7431     7446      +15     
  Branches      520      520              
==========================================
+ Hits         6354     6369      +15     
  Misses        911      911              
  Partials      166      166              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Dec 11, 2024

API Changelog 4.15.1.dev14+gd74ce1db

GET /api/v1/projects/{project_slug}/models/{model_slug}/provisioning

  • added the required property '/anyOf[subschema 1: ModelProvisioning]/session/anyOf[subschema 1: Session]/internal_endpoint' to the response with the '200' status

GET /api/v1/sessions

  • added the required property '/items/internal_endpoint' to the response with the '200' status

POST /api/v1/sessions

  • added the required property 'internal_endpoint' to the response with the '200' status

GET /api/v1/sessions/{session_id}

  • added the required property 'internal_endpoint' to the response with the '200' status

GET /api/v1/users/{user_id}/sessions

  • added the required property '/items/internal_endpoint' to the response with the '200' status

This comment has been minimized.

Copy link

The generated OpenAPI client is not up to date with the latest changes in the OpenAPI specification.
Please run make openapi locally and commit the changes.

This comment has been minimized.

This comment has been minimized.

Copy link

github-actions bot commented Dec 11, 2024

A Storybook preview is available for commit d74ce1d.
➡️ View Storybook
➡️ View Chromatic build

This comment has been minimized.

This comment has been minimized.

The internal endpoints can be received via the API for inter-session communication.

A new network route is available between sessions and the backend.
This enables sessions to use the backend API.

Two new pre-defined variables were added:
- `CAPELLACOLLAB_API_BASE_URL`
- `CAPELLACOLLAB_SESSION_REQUESTER_USER_ID`
Copy link

sonarcloud bot commented Dec 13, 2024

Copy link

This report was generated by comparing d74ce1d with c78b955.
If you would like to check difference, please check here.

success

ArtifactName: reg

✨✨ That's perfect, there is no visual difference! ✨✨

item count
pass 432
change 0
new 0
delete 0

@MoritzWeber0 MoritzWeber0 merged commit 47fc358 into main Dec 13, 2024
32 checks passed
@MoritzWeber0 MoritzWeber0 deleted the internal-endpoint branch December 13, 2024 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add internal endpoint to session response
2 participants