Skip to content

Commit

Permalink
Enhance API docs for spec and image registeration
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-github-robot authored Jun 26, 2024
2 parents beaf40c + 811ebfd commit 31a6932
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 31 deletions.
24 changes: 16 additions & 8 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6069,30 +6069,34 @@ const docTemplate = `{
"operationId": "PostImage",
"parameters": [
{
"enum": [
"registerWithInfo",
"registerWithId"
],
"type": "string",
"description": "registeringMethod (registerWithInfo or registerWithId)",
"description": "registeringMethod",
"name": "action",
"in": "query",
"required": true
},
{
"type": "string",
"default": "ns01",
"default": "system-purpose-common-ns",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"description": "Details for an image object",
"description": "Specify details of a image object (cspImageName, guestOS, description, ...) manually",
"name": "imageInfo",
"in": "body",
"schema": {
"$ref": "#/definitions/mcir.TbImageInfo"
}
},
{
"description": "name, connectionName and cspImageId",
"description": "Specify name, connectionName and cspImageId to register an image object automatically",
"name": "imageId",
"in": "body",
"schema": {
Expand Down Expand Up @@ -6872,9 +6876,13 @@ const docTemplate = `{
"operationId": "PostSpec",
"parameters": [
{
"enum": [
"registerWithInfo",
"registerWithCspSpecName"
],
"type": "string",
"description": "registerWithInfo or else",
"name": "registeringMethod",
"description": "registeringMethod",
"name": "action",
"in": "query",
"required": true
},
Expand All @@ -6887,15 +6895,15 @@ const docTemplate = `{
"required": true
},
{
"description": "Details for an spec object",
"description": "Specify details of a spec object (vCPU, memoryGiB, ...) manually",
"name": "specInfo",
"in": "body",
"schema": {
"$ref": "#/definitions/mcir.TbSpecInfo"
}
},
{
"description": "name, connectionName and cspSpecName",
"description": "Specify name, connectionName and cspSpecName to register a spec object automatically",
"name": "specName",
"in": "body",
"schema": {
Expand Down
24 changes: 16 additions & 8 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6062,30 +6062,34 @@
"operationId": "PostImage",
"parameters": [
{
"enum": [
"registerWithInfo",
"registerWithId"
],
"type": "string",
"description": "registeringMethod (registerWithInfo or registerWithId)",
"description": "registeringMethod",
"name": "action",
"in": "query",
"required": true
},
{
"type": "string",
"default": "ns01",
"default": "system-purpose-common-ns",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"description": "Details for an image object",
"description": "Specify details of a image object (cspImageName, guestOS, description, ...) manually",
"name": "imageInfo",
"in": "body",
"schema": {
"$ref": "#/definitions/mcir.TbImageInfo"
}
},
{
"description": "name, connectionName and cspImageId",
"description": "Specify name, connectionName and cspImageId to register an image object automatically",
"name": "imageId",
"in": "body",
"schema": {
Expand Down Expand Up @@ -6865,9 +6869,13 @@
"operationId": "PostSpec",
"parameters": [
{
"enum": [
"registerWithInfo",
"registerWithCspSpecName"
],
"type": "string",
"description": "registerWithInfo or else",
"name": "registeringMethod",
"description": "registeringMethod",
"name": "action",
"in": "query",
"required": true
},
Expand All @@ -6880,15 +6888,15 @@
"required": true
},
{
"description": "Details for an spec object",
"description": "Specify details of a spec object (vCPU, memoryGiB, ...) manually",
"name": "specInfo",
"in": "body",
"schema": {
"$ref": "#/definitions/mcir.TbSpecInfo"
}
},
{
"description": "name, connectionName and cspSpecName",
"description": "Specify name, connectionName and cspSpecName to register a spec object automatically",
"name": "specName",
"in": "body",
"schema": {
Expand Down
25 changes: 17 additions & 8 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7251,23 +7251,28 @@ paths:
description: Register image
operationId: PostImage
parameters:
- description: registeringMethod (registerWithInfo or registerWithId)
- description: registeringMethod
enum:
- registerWithInfo
- registerWithId
in: query
name: action
required: true
type: string
- default: ns01
- default: system-purpose-common-ns
description: Namespace ID
in: path
name: nsId
required: true
type: string
- description: Details for an image object
- description: Specify details of a image object (cspImageName, guestOS, description,
...) manually
in: body
name: imageInfo
schema:
$ref: '#/definitions/mcir.TbImageInfo'
- description: name, connectionName and cspImageId
- description: Specify name, connectionName and cspImageId to register an image
object automatically
in: body
name: imageId
schema:
Expand Down Expand Up @@ -7791,9 +7796,12 @@ paths:
description: Register spec
operationId: PostSpec
parameters:
- description: registerWithInfo or else
- description: registeringMethod
enum:
- registerWithInfo
- registerWithCspSpecName
in: query
name: registeringMethod
name: action
required: true
type: string
- default: system-purpose-common-ns
Expand All @@ -7802,12 +7810,13 @@ paths:
name: nsId
required: true
type: string
- description: Details for an spec object
- description: Specify details of a spec object (vCPU, memoryGiB, ...) manually
in: body
name: specInfo
schema:
$ref: '#/definitions/mcir.TbSpecInfo'
- description: name, connectionName and cspSpecName
- description: Specify name, connectionName and cspSpecName to register a spec
object automatically
in: body
name: specName
schema:
Expand Down
8 changes: 4 additions & 4 deletions src/api/rest/server/mcir/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
// @Tags [Infra resource] MCIR Image management
// @Accept json
// @Produce json
// @Param action query string true "registeringMethod (registerWithInfo or registerWithId)"
// @Param nsId path string true "Namespace ID" default(ns01)
// @Param imageInfo body mcir.TbImageInfo false "Details for an image object"
// @Param imageId body mcir.TbImageReq false "name, connectionName and cspImageId"
// @Param action query string true "registeringMethod" Enums(registerWithInfo, registerWithId)
// @Param nsId path string true "Namespace ID" default(system-purpose-common-ns)
// @Param imageInfo body mcir.TbImageInfo false "Specify details of a image object (cspImageName, guestOS, description, ...) manually"
// @Param imageId body mcir.TbImageReq false "Specify name, connectionName and cspImageId to register an image object automatically"
// @Param update query boolean false "Force update to existing image object" default(false)
// @Success 200 {object} mcir.TbImageInfo
// @Failure 404 {object} common.SimpleMsg
Expand Down
6 changes: 3 additions & 3 deletions src/api/rest/server/mcir/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
// @Tags [Infra resource] MCIR Spec management
// @Accept json
// @Produce json
// @Param registeringMethod query string true "registerWithInfo or else"
// @Param action query string true "registeringMethod" Enums(registerWithInfo, registerWithCspSpecName)
// @Param nsId path string true "Namespace ID" default(system-purpose-common-ns)
// @Param specInfo body mcir.TbSpecInfo false "Details for an spec object"
// @Param specName body mcir.TbSpecReq false "name, connectionName and cspSpecName"
// @Param specInfo body mcir.TbSpecInfo false "Specify details of a spec object (vCPU, memoryGiB, ...) manually"
// @Param specName body mcir.TbSpecReq false "Specify name, connectionName and cspSpecName to register a spec object automatically"
// @Param update query boolean false "Force update to existing spec object" default(false)
// @Success 200 {object} mcir.TbSpecInfo
// @Failure 404 {object} common.SimpleMsg
Expand Down

0 comments on commit 31a6932

Please sign in to comment.