From ad29872bdc97419c798ec50c1c898db302650846 Mon Sep 17 00:00:00 2001 From: Yunkon Kim Date: Tue, 12 Mar 2024 20:12:05 +0900 Subject: [PATCH] Fix incorrect response body of infra recommendation --- pkg/api/rest/controller/recommendation.go | 3 +- pkg/api/rest/docs/docs.go | 43 +++++++++++++++++------ pkg/api/rest/docs/swagger.json | 43 +++++++++++++++++------ pkg/api/rest/docs/swagger.yaml | 32 ++++++++++++++--- 4 files changed, 95 insertions(+), 26 deletions(-) diff --git a/pkg/api/rest/controller/recommendation.go b/pkg/api/rest/controller/recommendation.go index 19cfe25..6094eac 100644 --- a/pkg/api/rest/controller/recommendation.go +++ b/pkg/api/rest/controller/recommendation.go @@ -17,6 +17,7 @@ package controller import ( "net/http" + "github.com/cloud-barista/cm-beetle/pkg/api/rest/model" "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/source/infra" "github.com/cloud-barista/cm-beetle/pkg/core/common" "github.com/cloud-barista/cm-beetle/pkg/core/recommendation" @@ -40,7 +41,7 @@ type RecommendInfraRequest struct { } type RecommendInfraResponse struct { - Infrastructure + model.TbMcisDynamicReq } // RecommendInfra godoc diff --git a/pkg/api/rest/docs/docs.go b/pkg/api/rest/docs/docs.go index 3de9109..ce9fd6e 100644 --- a/pkg/api/rest/docs/docs.go +++ b/pkg/api/rest/docs/docs.go @@ -1523,21 +1523,44 @@ const docTemplate = `{ }, "controller.RecommendInfraResponse": { "type": "object", + "required": [ + "name", + "vm" + ], "properties": { - "compute": { - "type": "string" + "description": { + "type": "string", + "example": "Made in CB-TB" }, - "disk": { - "type": "string" + "installMonAgent": { + "description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)", + "type": "string", + "default": "yes", + "enum": [ + "yes", + "no" + ], + "example": "no" }, - "network": { - "type": "string" + "label": { + "description": "Label is for describing the mcis in a keyword (any string can be used)", + "type": "string", + "example": "DynamicVM" }, - "securityGroup": { - "type": "string" + "name": { + "type": "string", + "example": "mcis01" }, - "virtualMachine": { - "type": "string" + "systemLabel": { + "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "type": "string", + "example": "" + }, + "vm": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbVmDynamicReq" + } } } }, diff --git a/pkg/api/rest/docs/swagger.json b/pkg/api/rest/docs/swagger.json index 42a7640..dd363f2 100644 --- a/pkg/api/rest/docs/swagger.json +++ b/pkg/api/rest/docs/swagger.json @@ -1516,21 +1516,44 @@ }, "controller.RecommendInfraResponse": { "type": "object", + "required": [ + "name", + "vm" + ], "properties": { - "compute": { - "type": "string" + "description": { + "type": "string", + "example": "Made in CB-TB" }, - "disk": { - "type": "string" + "installMonAgent": { + "description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)", + "type": "string", + "default": "yes", + "enum": [ + "yes", + "no" + ], + "example": "no" }, - "network": { - "type": "string" + "label": { + "description": "Label is for describing the mcis in a keyword (any string can be used)", + "type": "string", + "example": "DynamicVM" }, - "securityGroup": { - "type": "string" + "name": { + "type": "string", + "example": "mcis01" }, - "virtualMachine": { - "type": "string" + "systemLabel": { + "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "type": "string", + "example": "" + }, + "vm": { + "type": "array", + "items": { + "$ref": "#/definitions/model.TbVmDynamicReq" + } } } }, diff --git a/pkg/api/rest/docs/swagger.yaml b/pkg/api/rest/docs/swagger.yaml index 8216869..f2245b4 100644 --- a/pkg/api/rest/docs/swagger.yaml +++ b/pkg/api/rest/docs/swagger.yaml @@ -345,16 +345,38 @@ definitions: type: object controller.RecommendInfraResponse: properties: - compute: + description: + example: Made in CB-TB type: string - disk: + installMonAgent: + default: "yes" + description: InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] + default:yes) + enum: + - "yes" + - "no" + example: "no" type: string - network: + label: + description: Label is for describing the mcis in a keyword (any string can + be used) + example: DynamicVM type: string - securityGroup: + name: + example: mcis01 type: string - virtualMachine: + systemLabel: + description: SystemLabel is for describing the mcis in a keyword (any string + can be used) for special System purpose + example: "" type: string + vm: + items: + $ref: '#/definitions/model.TbVmDynamicReq' + type: array + required: + - name + - vm type: object controller.UpdateUserRequest: properties: