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

Add Swagger godoc for CustomImage REST APIs #1212

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
233 changes: 232 additions & 1 deletion src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3550,6 +3550,85 @@ const docTemplate = `{
}
},
"/ns/{nsId}/resources/customImage": {
"get": {
"description": "List all customImages or customImages' ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] MCIR Custom Image management"
],
"summary": "List all customImages or customImages' ID",
"parameters": [
{
"type": "string",
"default": "ns01",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"enum": [
"id"
],
"type": "string",
"description": "Option",
"name": "option",
"in": "query"
},
{
"type": "string",
"description": "Field key for filtering (ex:guestOS)",
"name": "filterKey",
"in": "query"
},
{
"type": "string",
"description": "Field value for filtering (ex: Ubuntu18.04)",
"name": "filterVal",
"in": "query"
}
],
"responses": {
"200": {
"description": "Different return structures by the given option param",
"schema": {
"allOf": [
{
"$ref": "#/definitions/mcir.JSONResult"
},
{
"type": "object",
"properties": {
"[DEFAULT]": {
"$ref": "#/definitions/mcir.RestGetAllCustomImageResponse"
},
"[ID]": {
"$ref": "#/definitions/common.IdList"
}
}
}
]
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
},
"post": {
"description": "Create Custom Image",
"consumes": [
Expand Down Expand Up @@ -3578,7 +3657,8 @@ const docTemplate = `{
"type": "string",
"description": "Option: ",
"name": "option",
"in": "query"
"in": "query",
"required": true
},
{
"description": "Details for an Custom Image object",
Expand Down Expand Up @@ -3610,6 +3690,146 @@ const docTemplate = `{
}
}
}
},
"delete": {
"description": "Delete all customImages",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] MCIR Custom Image management"
],
"summary": "Delete all customImages",
"parameters": [
{
"type": "string",
"default": "ns01",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"type": "string",
"default": "",
"description": "Delete resources containing matched ID-substring only",
"name": "match",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.IdList"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/ns/{nsId}/resources/customImage/{customImageId}": {
"get": {
"description": "Get customImage",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] MCIR Custom Image management"
],
"summary": "Get customImage",
"parameters": [
{
"type": "string",
"default": "ns01",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "customImage ID",
"name": "customImageId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/mcir.TbCustomImageInfo"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
},
"delete": {
"description": "Delete customImage",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"[Infra resource] MCIR Custom Image management"
],
"summary": "Delete customImage",
"parameters": [
{
"type": "string",
"default": "ns01",
"description": "Namespace ID",
"name": "nsId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "customImage ID",
"name": "customImageId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/common.SimpleMsg"
}
}
}
}
},
"/ns/{nsId}/resources/dataDisk": {
Expand Down Expand Up @@ -6820,6 +7040,17 @@ const docTemplate = `{
}
}
},
"mcir.RestGetAllCustomImageResponse": {
"type": "object",
"properties": {
"customImage": {
"type": "array",
"items": {
"$ref": "#/definitions/mcir.TbCustomImageInfo"
}
}
}
},
"mcir.RestGetAllDataDiskResponse": {
"type": "object",
"properties": {
Expand Down
Loading