feat(ws): fix swagger warnings and only generate json output (#424)

* feat(ws): Clean and fix swagger warnings and errors

Signed-off-by: Liav Weiss (EXT-Nokia) <liav.weiss.ext@nokia.com>

* feat(ws): Clean and fix swagger warnings and errors

Signed-off-by: Liav Weiss (EXT-Nokia) <liav.weiss.ext@nokia.com>

---------

Signed-off-by: Liav Weiss (EXT-Nokia) <liav.weiss.ext@nokia.com>
Co-authored-by: Liav Weiss (EXT-Nokia) <liav.weiss.ext@nokia.com>
This commit is contained in:
Liav Weiss 2025-06-26 22:02:17 +03:00 committed by Bhakti Narvekar
parent 4c91627eb0
commit eb70a94274
6 changed files with 26 additions and 1034 deletions

View File

@ -74,7 +74,7 @@ SWAG_DIRS := cmd,$(ALL_GO_DIRS_NO_CMD)
.PHONY: swag
swag: SWAGGER
$(SWAGGER) fmt -g main.go -d $(SWAG_DIRS)
$(SWAGGER) init --parseDependency -q -g main.go -d $(SWAG_DIRS) --output openapi
$(SWAGGER) init --parseDependency -q -g main.go -d $(SWAG_DIRS) --output openapi --outputTypes go,json
##@ Build

View File

@ -42,7 +42,7 @@ type WorkspaceKindEnvelope Envelope[models.WorkspaceKind]
// @Tags workspacekinds
// @Accept json
// @Produce json
// @Param name path string true "Name of the workspace kind" example(jupyterlab)
// @Param name path string true "Name of the workspace kind" extensions(x-example=jupyterlab)
// @Success 200 {object} WorkspaceKindEnvelope "Successful operation. Returns the requested workspace kind details."
// @Failure 400 {object} ErrorEnvelope "Bad Request. Invalid workspace kind name format."
// @Failure 401 {object} ErrorEnvelope "Unauthorized. Authentication is required."
@ -50,7 +50,6 @@ type WorkspaceKindEnvelope Envelope[models.WorkspaceKind]
// @Failure 404 {object} ErrorEnvelope "Not Found. Workspace kind does not exist."
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspacekinds/{name} [get]
// @Security ApiKeyAuth
func (a *App) GetWorkspaceKindHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
name := ps.ByName(ResourceNamePathParam)
@ -102,7 +101,6 @@ func (a *App) GetWorkspaceKindHandler(w http.ResponseWriter, r *http.Request, ps
// @Failure 403 {object} ErrorEnvelope "Forbidden. User does not have permission to list workspace kinds."
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspacekinds [get]
// @Security ApiKeyAuth
func (a *App) GetWorkspaceKindsHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
// =========================== AUTH ===========================
authPolicies := []*auth.ResourcePolicy{

View File

@ -46,8 +46,8 @@ type WorkspaceEnvelope Envelope[models.Workspace]
// @Tags workspaces
// @Accept json
// @Produce json
// @Param namespace path string true "Namespace of the workspace" example(kubeflow-user-example-com)
// @Param workspace_name path string true "Name of the workspace" example(my-workspace)
// @Param namespace path string true "Namespace of the workspace" extensions(x-example=kubeflow-user-example-com)
// @Param workspace_name path string true "Name of the workspace" extensions(x-example=my-workspace)
// @Success 200 {object} WorkspaceEnvelope "Successful operation. Returns the requested workspace details."
// @Failure 400 {object} ErrorEnvelope "Bad Request. Invalid namespace or workspace name format."
// @Failure 401 {object} ErrorEnvelope "Unauthorized. Authentication is required."
@ -55,7 +55,6 @@ type WorkspaceEnvelope Envelope[models.Workspace]
// @Failure 404 {object} ErrorEnvelope "Not Found. Workspace does not exist."
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspaces/{namespace}/{workspace_name} [get]
// @Security ApiKeyAuth
func (a *App) GetWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
namespace := ps.ByName(NamespacePathParam)
workspaceName := ps.ByName(ResourceNamePathParam)
@ -109,7 +108,7 @@ func (a *App) GetWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps htt
// @Tags workspaces
// @Accept json
// @Produce json
// @Param namespace path string false "Namespace to filter workspaces. If not provided, returns all workspaces across all namespaces." example(kubeflow-user-example-com)
// @Param namespace path string true "Namespace to filter workspaces. If not provided, returns all workspaces across all namespaces." extensions(x-example=kubeflow-user-example-com)
// @Success 200 {object} WorkspaceListEnvelope "Successful operation. Returns a list of workspaces."
// @Failure 400 {object} ErrorEnvelope "Bad Request. Invalid namespace format."
// @Failure 401 {object} ErrorEnvelope "Unauthorized. Authentication is required."
@ -117,7 +116,6 @@ func (a *App) GetWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps htt
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspaces [get]
// @Router /workspaces/{namespace} [get]
// @Security ApiKeyAuth
func (a *App) GetWorkspacesHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
namespace := ps.ByName(NamespacePathParam)
@ -171,7 +169,7 @@ func (a *App) GetWorkspacesHandler(w http.ResponseWriter, r *http.Request, ps ht
// @Tags workspaces
// @Accept json
// @Produce json
// @Param namespace path string true "Namespace for the workspace" example(kubeflow-user-example-com)
// @Param namespace path string true "Namespace for the workspace" extensions(x-example=kubeflow-user-example-com)
// @Param body body WorkspaceCreateEnvelope true "Workspace creation configuration"
// @Success 201 {object} WorkspaceEnvelope "Workspace created successfully"
// @Failure 400 {object} ErrorEnvelope "Bad Request. Invalid request body or namespace format."
@ -180,7 +178,6 @@ func (a *App) GetWorkspacesHandler(w http.ResponseWriter, r *http.Request, ps ht
// @Failure 409 {object} ErrorEnvelope "Conflict. Workspace with the same name already exists."
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspaces/{namespace} [post]
// @Security ApiKeyAuth
func (a *App) CreateWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
namespace := ps.ByName(NamespacePathParam)
@ -266,8 +263,8 @@ func (a *App) CreateWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps
// @Tags workspaces
// @Accept json
// @Produce json
// @Param namespace path string true "Namespace of the workspace" example(kubeflow-user-example-com)
// @Param workspace_name path string true "Name of the workspace" example(my-workspace)
// @Param namespace path string true "Namespace of the workspace" extensions(x-example=kubeflow-user-example-com)
// @Param workspace_name path string true "Name of the workspace" extensions(x-example=my-workspace)
// @Success 204 {object} nil "Workspace deleted successfully"
// @Failure 400 {object} ErrorEnvelope "Bad Request. Invalid namespace or workspace name format."
// @Failure 401 {object} ErrorEnvelope "Unauthorized. Authentication is required."
@ -275,7 +272,6 @@ func (a *App) CreateWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps
// @Failure 404 {object} ErrorEnvelope "Not Found. Workspace does not exist."
// @Failure 500 {object} ErrorEnvelope "Internal server error. An unexpected error occurred on the server."
// @Router /workspaces/{namespace}/{workspace_name} [delete]
// @Security ApiKeyAuth
func (a *App) DeleteWorkspaceHandler(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
namespace := ps.ByName(NamespacePathParam)
workspaceName := ps.ByName(ResourceNamePathParam)

View File

@ -85,11 +85,6 @@ const docTemplate = `{
},
"/workspacekinds": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of all available workspace kinds. Workspace kinds define the different types of workspaces that can be created in the system.",
"consumes": [
"application/json"
@ -131,11 +126,6 @@ const docTemplate = `{
},
"/workspacekinds/{name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns details of a specific workspace kind identified by its name. Workspace kinds define the available types of workspaces that can be created.",
"consumes": [
"application/json"
@ -150,7 +140,7 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"example": "jupyterlab",
"x-example": "jupyterlab",
"description": "Name of the workspace kind",
"name": "name",
"in": "path",
@ -199,11 +189,6 @@ const docTemplate = `{
},
"/workspaces": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of workspaces. The endpoint supports two modes:\n1. List all workspaces across all namespaces (when no namespace is provided)\n2. List workspaces in a specific namespace (when namespace is provided)",
"consumes": [
"application/json"
@ -251,11 +236,6 @@ const docTemplate = `{
},
"/workspaces/{namespace}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of workspaces. The endpoint supports two modes:\n1. List all workspaces across all namespaces (when no namespace is provided)\n2. List workspaces in a specific namespace (when namespace is provided)",
"consumes": [
"application/json"
@ -270,10 +250,11 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace to filter workspaces. If not provided, returns all workspaces across all namespaces.",
"name": "namespace",
"in": "path"
"in": "path",
"required": true
}
],
"responses": {
@ -310,11 +291,6 @@ const docTemplate = `{
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Creates a new workspace in the specified namespace.",
"consumes": [
"application/json"
@ -329,7 +305,7 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace for the workspace",
"name": "namespace",
"in": "path",
@ -387,11 +363,6 @@ const docTemplate = `{
},
"/workspaces/{namespace}/{workspace_name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns details of a specific workspace identified by namespace and workspace name.",
"consumes": [
"application/json"
@ -406,7 +377,7 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace of the workspace",
"name": "namespace",
"in": "path",
@ -414,7 +385,7 @@ const docTemplate = `{
},
{
"type": "string",
"example": "my-workspace",
"x-example": "my-workspace",
"description": "Name of the workspace",
"name": "workspace_name",
"in": "path",
@ -461,11 +432,6 @@ const docTemplate = `{
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Deletes a specific workspace identified by namespace and workspace name.",
"consumes": [
"application/json"
@ -480,7 +446,7 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace of the workspace",
"name": "namespace",
"in": "path",
@ -488,7 +454,7 @@ const docTemplate = `{
},
{
"type": "string",
"example": "my-workspace",
"x-example": "my-workspace",
"description": "Name of the workspace",
"name": "workspace_name",
"in": "path",

View File

@ -83,11 +83,6 @@
},
"/workspacekinds": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of all available workspace kinds. Workspace kinds define the different types of workspaces that can be created in the system.",
"consumes": [
"application/json"
@ -129,11 +124,6 @@
},
"/workspacekinds/{name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns details of a specific workspace kind identified by its name. Workspace kinds define the available types of workspaces that can be created.",
"consumes": [
"application/json"
@ -148,7 +138,7 @@
"parameters": [
{
"type": "string",
"example": "jupyterlab",
"x-example": "jupyterlab",
"description": "Name of the workspace kind",
"name": "name",
"in": "path",
@ -197,11 +187,6 @@
},
"/workspaces": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of workspaces. The endpoint supports two modes:\n1. List all workspaces across all namespaces (when no namespace is provided)\n2. List workspaces in a specific namespace (when namespace is provided)",
"consumes": [
"application/json"
@ -249,11 +234,6 @@
},
"/workspaces/{namespace}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns a list of workspaces. The endpoint supports two modes:\n1. List all workspaces across all namespaces (when no namespace is provided)\n2. List workspaces in a specific namespace (when namespace is provided)",
"consumes": [
"application/json"
@ -268,10 +248,11 @@
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace to filter workspaces. If not provided, returns all workspaces across all namespaces.",
"name": "namespace",
"in": "path"
"in": "path",
"required": true
}
],
"responses": {
@ -308,11 +289,6 @@
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Creates a new workspace in the specified namespace.",
"consumes": [
"application/json"
@ -327,7 +303,7 @@
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace for the workspace",
"name": "namespace",
"in": "path",
@ -385,11 +361,6 @@
},
"/workspaces/{namespace}/{workspace_name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Returns details of a specific workspace identified by namespace and workspace name.",
"consumes": [
"application/json"
@ -404,7 +375,7 @@
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace of the workspace",
"name": "namespace",
"in": "path",
@ -412,7 +383,7 @@
},
{
"type": "string",
"example": "my-workspace",
"x-example": "my-workspace",
"description": "Name of the workspace",
"name": "workspace_name",
"in": "path",
@ -459,11 +430,6 @@
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Deletes a specific workspace identified by namespace and workspace name.",
"consumes": [
"application/json"
@ -478,7 +444,7 @@
"parameters": [
{
"type": "string",
"example": "kubeflow-user-example-com",
"x-example": "kubeflow-user-example-com",
"description": "Namespace of the workspace",
"name": "namespace",
"in": "path",
@ -486,7 +452,7 @@
},
{
"type": "string",
"example": "my-workspace",
"x-example": "my-workspace",
"description": "Name of the workspace",
"name": "workspace_name",
"in": "path",

View File

@ -1,934 +0,0 @@
basePath: /api/v1
definitions:
api.ErrorCause:
properties:
validation_errors:
items:
$ref: '#/definitions/api.ValidationError'
type: array
type: object
api.ErrorEnvelope:
properties:
error:
$ref: '#/definitions/api.HTTPError'
type: object
api.HTTPError:
properties:
cause:
$ref: '#/definitions/api.ErrorCause'
code:
type: string
message:
type: string
type: object
api.NamespaceListEnvelope:
properties:
data:
items:
$ref: '#/definitions/namespaces.Namespace'
type: array
type: object
api.ValidationError:
properties:
field:
type: string
message:
type: string
type:
$ref: '#/definitions/field.ErrorType'
type: object
api.WorkspaceCreateEnvelope:
properties:
data:
$ref: '#/definitions/workspaces.WorkspaceCreate'
type: object
api.WorkspaceEnvelope:
properties:
data:
$ref: '#/definitions/workspaces.Workspace'
type: object
api.WorkspaceKindEnvelope:
properties:
data:
$ref: '#/definitions/workspacekinds.WorkspaceKind'
type: object
api.WorkspaceKindListEnvelope:
properties:
data:
items:
$ref: '#/definitions/workspacekinds.WorkspaceKind'
type: array
type: object
api.WorkspaceListEnvelope:
properties:
data:
items:
$ref: '#/definitions/workspaces.Workspace'
type: array
type: object
field.ErrorType:
enum:
- FieldValueNotFound
- FieldValueRequired
- FieldValueDuplicate
- FieldValueInvalid
- FieldValueNotSupported
- FieldValueForbidden
- FieldValueTooLong
- FieldValueTooMany
- InternalError
- FieldValueTypeInvalid
type: string
x-enum-varnames:
- ErrorTypeNotFound
- ErrorTypeRequired
- ErrorTypeDuplicate
- ErrorTypeInvalid
- ErrorTypeNotSupported
- ErrorTypeForbidden
- ErrorTypeTooLong
- ErrorTypeTooMany
- ErrorTypeInternal
- ErrorTypeTypeInvalid
health_check.HealthCheck:
properties:
status:
$ref: '#/definitions/health_check.ServiceStatus'
systemInfo:
$ref: '#/definitions/health_check.SystemInfo'
type: object
health_check.ServiceStatus:
enum:
- Healthy
- Unhealthy
type: string
x-enum-varnames:
- ServiceStatusHealthy
- ServiceStatusUnhealthy
health_check.SystemInfo:
properties:
version:
type: string
type: object
namespaces.Namespace:
properties:
name:
type: string
type: object
workspacekinds.ImageConfig:
properties:
default:
type: string
values:
items:
$ref: '#/definitions/workspacekinds.ImageConfigValue'
type: array
type: object
workspacekinds.ImageConfigValue:
properties:
description:
type: string
displayName:
type: string
hidden:
type: boolean
id:
type: string
labels:
items:
$ref: '#/definitions/workspacekinds.OptionLabel'
type: array
redirect:
$ref: '#/definitions/workspacekinds.OptionRedirect'
type: object
workspacekinds.ImageRef:
properties:
url:
type: string
type: object
workspacekinds.OptionLabel:
properties:
key:
type: string
value:
type: string
type: object
workspacekinds.OptionRedirect:
properties:
message:
$ref: '#/definitions/workspacekinds.RedirectMessage'
to:
type: string
type: object
workspacekinds.PodConfig:
properties:
default:
type: string
values:
items:
$ref: '#/definitions/workspacekinds.PodConfigValue'
type: array
type: object
workspacekinds.PodConfigValue:
properties:
description:
type: string
displayName:
type: string
hidden:
type: boolean
id:
type: string
labels:
items:
$ref: '#/definitions/workspacekinds.OptionLabel'
type: array
redirect:
$ref: '#/definitions/workspacekinds.OptionRedirect'
type: object
workspacekinds.PodMetadata:
properties:
annotations:
additionalProperties:
type: string
type: object
labels:
additionalProperties:
type: string
type: object
type: object
workspacekinds.PodTemplate:
properties:
options:
$ref: '#/definitions/workspacekinds.PodTemplateOptions'
podMetadata:
$ref: '#/definitions/workspacekinds.PodMetadata'
volumeMounts:
$ref: '#/definitions/workspacekinds.PodVolumeMounts'
type: object
workspacekinds.PodTemplateOptions:
properties:
imageConfig:
$ref: '#/definitions/workspacekinds.ImageConfig'
podConfig:
$ref: '#/definitions/workspacekinds.PodConfig'
type: object
workspacekinds.PodVolumeMounts:
properties:
home:
type: string
type: object
workspacekinds.RedirectMessage:
properties:
level:
$ref: '#/definitions/workspacekinds.RedirectMessageLevel'
text:
type: string
type: object
workspacekinds.RedirectMessageLevel:
enum:
- Info
- Warning
- Danger
type: string
x-enum-varnames:
- RedirectMessageLevelInfo
- RedirectMessageLevelWarning
- RedirectMessageLevelDanger
workspacekinds.WorkspaceKind:
properties:
deprecated:
type: boolean
deprecationMessage:
type: string
description:
type: string
displayName:
type: string
hidden:
type: boolean
icon:
$ref: '#/definitions/workspacekinds.ImageRef'
logo:
$ref: '#/definitions/workspacekinds.ImageRef'
name:
type: string
podTemplate:
$ref: '#/definitions/workspacekinds.PodTemplate'
type: object
workspaces.Activity:
properties:
lastActivity:
description: Unix Epoch time
type: integer
lastProbe:
$ref: '#/definitions/workspaces.LastProbeInfo'
lastUpdate:
description: Unix Epoch time
type: integer
type: object
workspaces.HttpService:
properties:
displayName:
type: string
httpPath:
type: string
type: object
workspaces.ImageConfig:
properties:
current:
$ref: '#/definitions/workspaces.OptionInfo'
desired:
$ref: '#/definitions/workspaces.OptionInfo'
redirectChain:
items:
$ref: '#/definitions/workspaces.RedirectStep'
type: array
type: object
workspaces.ImageRef:
properties:
url:
type: string
type: object
workspaces.LastProbeInfo:
properties:
endTimeMs:
description: Unix Epoch time in milliseconds
type: integer
message:
type: string
result:
$ref: '#/definitions/workspaces.ProbeResult'
startTimeMs:
description: Unix Epoch time in milliseconds
type: integer
type: object
workspaces.OptionInfo:
properties:
description:
type: string
displayName:
type: string
id:
type: string
labels:
items:
$ref: '#/definitions/workspaces.OptionLabel'
type: array
type: object
workspaces.OptionLabel:
properties:
key:
type: string
value:
type: string
type: object
workspaces.PodConfig:
properties:
current:
$ref: '#/definitions/workspaces.OptionInfo'
desired:
$ref: '#/definitions/workspaces.OptionInfo'
redirectChain:
items:
$ref: '#/definitions/workspaces.RedirectStep'
type: array
type: object
workspaces.PodMetadata:
properties:
annotations:
additionalProperties:
type: string
type: object
labels:
additionalProperties:
type: string
type: object
type: object
workspaces.PodMetadataMutate:
properties:
annotations:
additionalProperties:
type: string
type: object
labels:
additionalProperties:
type: string
type: object
type: object
workspaces.PodSecretInfo:
properties:
defaultMode:
type: integer
mountPath:
type: string
secretName:
type: string
type: object
workspaces.PodSecretMount:
properties:
defaultMode:
type: integer
mountPath:
type: string
secretName:
type: string
type: object
workspaces.PodTemplate:
properties:
options:
$ref: '#/definitions/workspaces.PodTemplateOptions'
podMetadata:
$ref: '#/definitions/workspaces.PodMetadata'
volumes:
$ref: '#/definitions/workspaces.PodVolumes'
type: object
workspaces.PodTemplateMutate:
properties:
options:
$ref: '#/definitions/workspaces.PodTemplateOptionsMutate'
podMetadata:
$ref: '#/definitions/workspaces.PodMetadataMutate'
volumes:
$ref: '#/definitions/workspaces.PodVolumesMutate'
type: object
workspaces.PodTemplateOptions:
properties:
imageConfig:
$ref: '#/definitions/workspaces.ImageConfig'
podConfig:
$ref: '#/definitions/workspaces.PodConfig'
type: object
workspaces.PodTemplateOptionsMutate:
properties:
imageConfig:
type: string
podConfig:
type: string
type: object
workspaces.PodVolumeInfo:
properties:
mountPath:
type: string
pvcName:
type: string
readOnly:
type: boolean
type: object
workspaces.PodVolumeMount:
properties:
mountPath:
type: string
pvcName:
type: string
readOnly:
type: boolean
type: object
workspaces.PodVolumes:
properties:
data:
items:
$ref: '#/definitions/workspaces.PodVolumeInfo'
type: array
home:
$ref: '#/definitions/workspaces.PodVolumeInfo'
secrets:
items:
$ref: '#/definitions/workspaces.PodSecretInfo'
type: array
type: object
workspaces.PodVolumesMutate:
properties:
data:
items:
$ref: '#/definitions/workspaces.PodVolumeMount'
type: array
home:
type: string
secrets:
items:
$ref: '#/definitions/workspaces.PodSecretMount'
type: array
type: object
workspaces.ProbeResult:
enum:
- Success
- Failure
- Timeout
type: string
x-enum-varnames:
- ProbeResultSuccess
- ProbeResultFailure
- ProbeResultTimeout
workspaces.RedirectMessage:
properties:
level:
$ref: '#/definitions/workspaces.RedirectMessageLevel'
text:
type: string
type: object
workspaces.RedirectMessageLevel:
enum:
- Info
- Warning
- Danger
type: string
x-enum-varnames:
- RedirectMessageLevelInfo
- RedirectMessageLevelWarning
- RedirectMessageLevelDanger
workspaces.RedirectStep:
properties:
message:
$ref: '#/definitions/workspaces.RedirectMessage'
sourceId:
type: string
targetId:
type: string
type: object
workspaces.Service:
properties:
httpService:
$ref: '#/definitions/workspaces.HttpService'
type: object
workspaces.Workspace:
properties:
activity:
$ref: '#/definitions/workspaces.Activity'
deferUpdates:
type: boolean
name:
type: string
namespace:
type: string
paused:
type: boolean
pausedTime:
type: integer
pendingRestart:
type: boolean
podTemplate:
$ref: '#/definitions/workspaces.PodTemplate'
services:
items:
$ref: '#/definitions/workspaces.Service'
type: array
state:
$ref: '#/definitions/workspaces.WorkspaceState'
stateMessage:
type: string
workspaceKind:
$ref: '#/definitions/workspaces.WorkspaceKindInfo'
type: object
workspaces.WorkspaceCreate:
properties:
deferUpdates:
type: boolean
kind:
type: string
name:
type: string
paused:
type: boolean
podTemplate:
$ref: '#/definitions/workspaces.PodTemplateMutate'
type: object
workspaces.WorkspaceKindInfo:
properties:
icon:
$ref: '#/definitions/workspaces.ImageRef'
logo:
$ref: '#/definitions/workspaces.ImageRef'
missing:
type: boolean
name:
type: string
type: object
workspaces.WorkspaceState:
enum:
- Running
- Terminating
- Paused
- Pending
- Error
- Unknown
type: string
x-enum-varnames:
- WorkspaceStateRunning
- WorkspaceStateTerminating
- WorkspaceStatePaused
- WorkspaceStatePending
- WorkspaceStateError
- WorkspaceStateUnknown
host: localhost:4000
info:
contact: {}
description: |-
This API provides endpoints to manage notebooks in a Kubernetes cluster.
For more information, visit https://www.kubeflow.org/docs/components/notebooks/
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Kubeflow Notebooks API
version: 1.0.0
paths:
/healthcheck:
get:
description: Provides a healthcheck response indicating the status of key services.
produces:
- application/json
responses:
"200":
description: Successful healthcheck response
schema:
$ref: '#/definitions/health_check.HealthCheck'
"500":
description: Internal server error
schema:
$ref: '#/definitions/api.ErrorEnvelope'
summary: Returns the health status of the application
tags:
- healthcheck
/namespaces:
get:
description: Provides a list of all namespaces that the user has access to
produces:
- application/json
responses:
"200":
description: Successful namespaces response
schema:
$ref: '#/definitions/api.NamespaceListEnvelope'
"401":
description: Unauthorized
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error
schema:
$ref: '#/definitions/api.ErrorEnvelope'
summary: Returns a list of all namespaces
tags:
- namespaces
/workspacekinds:
get:
consumes:
- application/json
description: Returns a list of all available workspace kinds. Workspace kinds
define the different types of workspaces that can be created in the system.
produces:
- application/json
responses:
"200":
description: Successful operation. Returns a list of all available workspace
kinds.
schema:
$ref: '#/definitions/api.WorkspaceKindListEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to list workspace
kinds.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: List workspace kinds
tags:
- workspacekinds
/workspacekinds/{name}:
get:
consumes:
- application/json
description: Returns details of a specific workspace kind identified by its
name. Workspace kinds define the available types of workspaces that can be
created.
parameters:
- description: Name of the workspace kind
example: jupyterlab
in: path
name: name
required: true
type: string
produces:
- application/json
responses:
"200":
description: Successful operation. Returns the requested workspace kind
details.
schema:
$ref: '#/definitions/api.WorkspaceKindEnvelope'
"400":
description: Bad Request. Invalid workspace kind name format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to access the workspace
kind.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"404":
description: Not Found. Workspace kind does not exist.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: Get workspace kind
tags:
- workspacekinds
/workspaces:
get:
consumes:
- application/json
description: |-
Returns a list of workspaces. The endpoint supports two modes:
1. List all workspaces across all namespaces (when no namespace is provided)
2. List workspaces in a specific namespace (when namespace is provided)
produces:
- application/json
responses:
"200":
description: Successful operation. Returns a list of workspaces.
schema:
$ref: '#/definitions/api.WorkspaceListEnvelope'
"400":
description: Bad Request. Invalid namespace format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to list workspaces.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: List workspaces
tags:
- workspaces
/workspaces/{namespace}:
get:
consumes:
- application/json
description: |-
Returns a list of workspaces. The endpoint supports two modes:
1. List all workspaces across all namespaces (when no namespace is provided)
2. List workspaces in a specific namespace (when namespace is provided)
parameters:
- description: Namespace to filter workspaces. If not provided, returns all
workspaces across all namespaces.
example: kubeflow-user-example-com
in: path
name: namespace
type: string
produces:
- application/json
responses:
"200":
description: Successful operation. Returns a list of workspaces.
schema:
$ref: '#/definitions/api.WorkspaceListEnvelope'
"400":
description: Bad Request. Invalid namespace format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to list workspaces.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: List workspaces
tags:
- workspaces
post:
consumes:
- application/json
description: Creates a new workspace in the specified namespace.
parameters:
- description: Namespace for the workspace
example: kubeflow-user-example-com
in: path
name: namespace
required: true
type: string
- description: Workspace creation configuration
in: body
name: body
required: true
schema:
$ref: '#/definitions/api.WorkspaceCreateEnvelope'
produces:
- application/json
responses:
"201":
description: Workspace created successfully
schema:
$ref: '#/definitions/api.WorkspaceEnvelope'
"400":
description: Bad Request. Invalid request body or namespace format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to create workspace.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"409":
description: Conflict. Workspace with the same name already exists.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: Create workspace
tags:
- workspaces
/workspaces/{namespace}/{workspace_name}:
delete:
consumes:
- application/json
description: Deletes a specific workspace identified by namespace and workspace
name.
parameters:
- description: Namespace of the workspace
example: kubeflow-user-example-com
in: path
name: namespace
required: true
type: string
- description: Name of the workspace
example: my-workspace
in: path
name: workspace_name
required: true
type: string
produces:
- application/json
responses:
"204":
description: Workspace deleted successfully
"400":
description: Bad Request. Invalid namespace or workspace name format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to delete the workspace.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"404":
description: Not Found. Workspace does not exist.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: Delete workspace
tags:
- workspaces
get:
consumes:
- application/json
description: Returns details of a specific workspace identified by namespace
and workspace name.
parameters:
- description: Namespace of the workspace
example: kubeflow-user-example-com
in: path
name: namespace
required: true
type: string
- description: Name of the workspace
example: my-workspace
in: path
name: workspace_name
required: true
type: string
produces:
- application/json
responses:
"200":
description: Successful operation. Returns the requested workspace details.
schema:
$ref: '#/definitions/api.WorkspaceEnvelope'
"400":
description: Bad Request. Invalid namespace or workspace name format.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"401":
description: Unauthorized. Authentication is required.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"403":
description: Forbidden. User does not have permission to access the workspace.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"404":
description: Not Found. Workspace does not exist.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
"500":
description: Internal server error. An unexpected error occurred on the
server.
schema:
$ref: '#/definitions/api.ErrorEnvelope'
security:
- ApiKeyAuth: []
summary: Get workspace
tags:
- workspaces
schemes:
- http
- https
swagger: "2.0"