diff --git a/components/renku_data_services/notebooks/api.spec.yaml b/components/renku_data_services/notebooks/api.spec.yaml index cf11d5cc5..b8c7f6189 100644 --- a/components/renku_data_services/notebooks/api.spec.yaml +++ b/components/renku_data_services/notebooks/api.spec.yaml @@ -21,9 +21,16 @@ paths: minLength: 1 responses: '200': - description: The Docker image is available. - '404': - description: The Docker image is not available. + content: + application/json: + schema: + "$ref": "#/components/schemas/ImageCheckResponse" + '422': + content: + application/json: + schema: + "$ref": "#/components/schemas/ErrorResponse" + description: The image url is malformed. tags: - notebooks "/notebooks/logs/{server_name}": @@ -355,27 +362,28 @@ paths: tags: - sessions "/sessions/images": - get: - summary: Check if a session image exists - parameters: - - description: The Docker image URL (tag included) that should be fetched. - in: query - name: image_url - required: true - schema: - type: string - minLength: 1 - responses: - "200": - description: The docker image can be found - "404": - description: The docker image cannot be found or the user does not have permissions to access it - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - default: - $ref: "#/components/responses/Error" + get: + description: Check if a session image exists + parameters: + - description: The Docker image URL (tag included) that should be fetched. + in: query + name: image_url + required: true + schema: + type: string + minLength: 1 + responses: + '200': + content: + application/json: + schema: + "$ref": "#/components/schemas/ImageCheckResponse" + '422': + content: + application/json: + schema: + "$ref": "#/components/schemas/ErrorResponse" + description: The image url is malformed. tags: - sessions components: @@ -1036,7 +1044,37 @@ components: maxLength: 50 pattern: '^[a-z]([-a-z0-9]*[a-z0-9])?$' example: d185e68d-d43-renku-2-b9ac279a4e8a85ac28d08 + ImageCheckResponse: + type: object + properties: + accessible: + type: boolean + description: Whether the image is accessible or not. + connection: + allOf: + - "$ref": "#/components/schemas/ImageConnectionStatus" + - description: Whether an oauth2 connection is or can be used to access the image. If null indicates that there is no oauth2 connection we can use to access the requested image. + required: + - accessible + ImageConnection: + type: object + properties: + id: + type: string + status: + "$ref": "#/components/schemas/ImageConnectionStatus" + required: + - id + - status + ImageConnectionStatus: + type: string + enum: + - connected + - pending + - disconnected responses: + ImageCheckResponse: + description: Information about whether a docker image is available or not and if there is a connected service then which connected service can be used to access the image. Error: description: The schema for all 4xx and 5xx responses content: diff --git a/components/renku_data_services/notebooks/apispec.py b/components/renku_data_services/notebooks/apispec.py index 8f5673816..4cbb9a363 100644 --- a/components/renku_data_services/notebooks/apispec.py +++ b/components/renku_data_services/notebooks/apispec.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: api.spec.yaml -# timestamp: 2025-04-17T14:26:28+00:00 +# timestamp: 2025-08-26T12:05:22+00:00 from __future__ import annotations @@ -281,6 +281,12 @@ class SessionCloudStoragePost(BaseAPISpec): ) +class ImageConnectionStatus(Enum): + connected = "connected" + pending = "pending" + disconnected = "disconnected" + + class NotebooksImagesGetParametersQuery(BaseAPISpec): image_url: str = Field(..., min_length=1) @@ -356,6 +362,16 @@ class SessionResources(BaseAPISpec): requests: Optional[SessionResourcesRequests] = None +class ImageCheckResponse(BaseAPISpec): + accessible: bool = Field(..., description="Whether the image is accessible or not.") + connection: Optional[ImageConnectionStatus] = None + + +class ImageConnection(BaseAPISpec): + id: str + status: ImageConnectionStatus + + class NotebookResponse(BaseAPISpec): annotations: Optional[FieldUserPodAnnotations] = None cloudstorage: Optional[List[LaunchNotebookResponseCloudStorage]] = None