Skip to content

Commit

Permalink
Add swagger api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
olevitt committed Mar 29, 2024
1 parent dc4b705 commit 5a64d61
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
api
config.local.yaml
onyxia-api
176 changes: 176 additions & 0 deletions api/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
// Package api Code generated by swaggo/swag. DO NOT EDIT
package api

import "github.com/swaggo/swag"

const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/my-lab/quota": {
"get": {
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "List the quotas in a namespace.",
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "Change the quotas for a namespace.",
"parameters": [
{
"description": "Modify quotas",
"name": "newQuota",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cmd.model"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/my-lab/services": {
"get": {
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "List the services installed in a namespace.",
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/onboarding": {
"post": {
"description": "Create or replace the namespace of the user or the namespace of a group if the user is in the requested group and the according rbac policies. with the group prefix / user prefix of the region",
"produces": [
"application/json"
],
"tags": [
"Onboarding"
],
"summary": "Init a namespace for a user or a group",
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/public/ip": {
"get": {
"description": "Get the public IP (as seen by this app).",
"produces": [
"application/json"
],
"tags": [
"public"
],
"summary": "Get your public IP address.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/user/info": {
"get": {
"description": "Get user info and projects",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get user info",
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"definitions": {
"cmd.model": {
"type": "object",
"properties": {
"namespace": {
"description": "Namespace of the quota",
"type": "string",
"format": "string",
"example": "default"
},
"newLimit": {
"description": "New limit for the quota",
"type": "integer",
"format": "int",
"example": 100
},
"quotaName": {
"description": "Name of the quota",
"type": "string",
"format": "string",
"example": "name"
}
}
}
}
}`

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}

func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
147 changes: 147 additions & 0 deletions api/swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/my-lab/quota": {
"get": {
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "List the quotas in a namespace.",
"responses": {
"200": {
"description": "OK"
}
}
},
"post": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "Change the quotas for a namespace.",
"parameters": [
{
"description": "Modify quotas",
"name": "newQuota",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/cmd.model"
}
}
],
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/my-lab/services": {
"get": {
"produces": [
"application/json"
],
"tags": [
"My lab"
],
"summary": "List the services installed in a namespace.",
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/onboarding": {
"post": {
"description": "Create or replace the namespace of the user or the namespace of a group if the user is in the requested group and the according rbac policies. with the group prefix / user prefix of the region",
"produces": [
"application/json"
],
"tags": [
"Onboarding"
],
"summary": "Init a namespace for a user or a group",
"responses": {
"200": {
"description": "OK"
}
}
}
},
"/public/ip": {
"get": {
"description": "Get the public IP (as seen by this app).",
"produces": [
"application/json"
],
"tags": [
"public"
],
"summary": "Get your public IP address.",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/user/info": {
"get": {
"description": "Get user info and projects",
"produces": [
"application/json"
],
"tags": [
"user"
],
"summary": "Get user info",
"responses": {
"200": {
"description": "OK"
}
}
}
}
},
"definitions": {
"cmd.model": {
"type": "object",
"properties": {
"namespace": {
"description": "Namespace of the quota",
"type": "string",
"format": "string",
"example": "default"
},
"newLimit": {
"description": "New limit for the quota",
"type": "integer",
"format": "int",
"example": 100
},
"quotaName": {
"description": "Name of the quota",
"type": "string",
"format": "string",
"example": "name"
}
}
}
}
}
Loading

0 comments on commit 5a64d61

Please sign in to comment.