From ee2cb88e5ce8f809f634e68679ac6282de2ccf98 Mon Sep 17 00:00:00 2001 From: seokho-son Date: Mon, 7 Oct 2024 01:19:39 +0000 Subject: [PATCH] Update Swagger REST API doc --- src/api/rest/docs/docs.go | 78 ++++++++++++++++++++++------------ src/api/rest/docs/swagger.json | 78 ++++++++++++++++++++++------------ src/api/rest/docs/swagger.yaml | 62 ++++++++++++++++++--------- 3 files changed, 146 insertions(+), 72 deletions(-) diff --git a/src/api/rest/docs/docs.go b/src/api/rest/docs/docs.go index 9fd1a690..0c277ff2 100644 --- a/src/api/rest/docs/docs.go +++ b/src/api/rest/docs/docs.go @@ -10614,14 +10614,18 @@ const docTemplate = `{ }, "model.IID": { "type": "object", + "required": [ + "NameId", + "SystemId" + ], "properties": { - "nameId": { - "description": "NameID by user", - "type": "string" + "NameId": { + "type": "string", + "example": "user-defined-name" }, - "systemId": { - "description": "SystemID by CloudOS", - "type": "string" + "SystemId": { + "type": "string", + "example": "csp-defined-id" } } }, @@ -11912,11 +11916,23 @@ const docTemplate = `{ }, "model.SpiderNodeGroupInfo": { "type": "object", + "required": [ + "DesiredNodeSize", + "IId", + "ImageIID", + "KeyPairIID", + "MaxNodeSize", + "MinNodeSize", + "OnAutoScaling", + "Status", + "VMSpecName" + ], "properties": { - "desiredNodeSize": { - "type": "integer" + "DesiredNodeSize": { + "type": "integer", + "example": 2 }, - "iid": { + "IId": { "description": "{NameId, SystemId}", "allOf": [ { @@ -11924,7 +11940,7 @@ const docTemplate = `{ } ] }, - "imageIID": { + "ImageIID": { "description": "VM config.", "allOf": [ { @@ -11932,44 +11948,54 @@ const docTemplate = `{ } ] }, - "keyPairIID": { + "KeyPairIID": { "$ref": "#/definitions/model.IID" }, - "keyValueList": { + "KeyValueList": { "type": "array", "items": { "$ref": "#/definitions/model.KeyValue" } }, - "maxNodeSize": { - "type": "integer" + "MaxNodeSize": { + "type": "integer", + "example": 3 }, - "minNodeSize": { - "type": "integer" + "MinNodeSize": { + "type": "integer", + "example": 1 }, - "nodes": { + "Nodes": { "type": "array", "items": { "$ref": "#/definitions/model.IID" } }, - "onAutoScaling": { + "OnAutoScaling": { "description": "Scaling config.", - "type": "boolean" + "type": "boolean", + "example": true }, - "rootDiskSize": { + "RootDiskSize": { "description": "\"\", \"default\", \"50\", \"1000\" (GB)", - "type": "string" + "type": "string", + "example": "50" }, - "rootDiskType": { + "RootDiskType": { "description": "\"SSD(gp2)\", \"Premium SSD\", ...", "type": "string" }, - "status": { - "$ref": "#/definitions/model.SpiderNodeGroupStatus" + "Status": { + "allOf": [ + { + "$ref": "#/definitions/model.SpiderNodeGroupStatus" + } + ], + "example": "Active" }, - "vmspecName": { - "type": "string" + "VMSpecName": { + "type": "string", + "example": "t3.medium" } } }, diff --git a/src/api/rest/docs/swagger.json b/src/api/rest/docs/swagger.json index 0f5e9f8f..8bfbc8d2 100644 --- a/src/api/rest/docs/swagger.json +++ b/src/api/rest/docs/swagger.json @@ -10607,14 +10607,18 @@ }, "model.IID": { "type": "object", + "required": [ + "NameId", + "SystemId" + ], "properties": { - "nameId": { - "description": "NameID by user", - "type": "string" + "NameId": { + "type": "string", + "example": "user-defined-name" }, - "systemId": { - "description": "SystemID by CloudOS", - "type": "string" + "SystemId": { + "type": "string", + "example": "csp-defined-id" } } }, @@ -11905,11 +11909,23 @@ }, "model.SpiderNodeGroupInfo": { "type": "object", + "required": [ + "DesiredNodeSize", + "IId", + "ImageIID", + "KeyPairIID", + "MaxNodeSize", + "MinNodeSize", + "OnAutoScaling", + "Status", + "VMSpecName" + ], "properties": { - "desiredNodeSize": { - "type": "integer" + "DesiredNodeSize": { + "type": "integer", + "example": 2 }, - "iid": { + "IId": { "description": "{NameId, SystemId}", "allOf": [ { @@ -11917,7 +11933,7 @@ } ] }, - "imageIID": { + "ImageIID": { "description": "VM config.", "allOf": [ { @@ -11925,44 +11941,54 @@ } ] }, - "keyPairIID": { + "KeyPairIID": { "$ref": "#/definitions/model.IID" }, - "keyValueList": { + "KeyValueList": { "type": "array", "items": { "$ref": "#/definitions/model.KeyValue" } }, - "maxNodeSize": { - "type": "integer" + "MaxNodeSize": { + "type": "integer", + "example": 3 }, - "minNodeSize": { - "type": "integer" + "MinNodeSize": { + "type": "integer", + "example": 1 }, - "nodes": { + "Nodes": { "type": "array", "items": { "$ref": "#/definitions/model.IID" } }, - "onAutoScaling": { + "OnAutoScaling": { "description": "Scaling config.", - "type": "boolean" + "type": "boolean", + "example": true }, - "rootDiskSize": { + "RootDiskSize": { "description": "\"\", \"default\", \"50\", \"1000\" (GB)", - "type": "string" + "type": "string", + "example": "50" }, - "rootDiskType": { + "RootDiskType": { "description": "\"SSD(gp2)\", \"Premium SSD\", ...", "type": "string" }, - "status": { - "$ref": "#/definitions/model.SpiderNodeGroupStatus" + "Status": { + "allOf": [ + { + "$ref": "#/definitions/model.SpiderNodeGroupStatus" + } + ], + "example": "Active" }, - "vmspecName": { - "type": "string" + "VMSpecName": { + "type": "string", + "example": "t3.medium" } } }, diff --git a/src/api/rest/docs/swagger.yaml b/src/api/rest/docs/swagger.yaml index 530121c1..4d197fea 100644 --- a/src/api/rest/docs/swagger.yaml +++ b/src/api/rest/docs/swagger.yaml @@ -7992,14 +7992,17 @@ components: vCPU: $ref: '#/components/schemas/model.Range' model.IID: + required: + - NameId + - SystemId type: object properties: - nameId: + NameId: type: string - description: NameID by user - systemId: + example: user-defined-name + SystemId: type: string - description: SystemID by CloudOS + example: csp-defined-id model.IdList: type: object properties: @@ -8866,47 +8869,66 @@ components: allOf: - $ref: '#/components/schemas/model.IID' model.SpiderNodeGroupInfo: - type: object - properties: - desiredNodeSize: + required: + - DesiredNodeSize + - IId + - ImageIID + - KeyPairIID + - MaxNodeSize + - MinNodeSize + - OnAutoScaling + - Status + - VMSpecName + type: object + properties: + DesiredNodeSize: type: integer - iid: + example: 2 + IId: type: object description: "{NameId, SystemId}" allOf: - $ref: '#/components/schemas/model.IID' - imageIID: + ImageIID: type: object description: VM config. allOf: - $ref: '#/components/schemas/model.IID' - keyPairIID: + KeyPairIID: $ref: '#/components/schemas/model.IID' - keyValueList: + KeyValueList: type: array items: $ref: '#/components/schemas/model.KeyValue' - maxNodeSize: + MaxNodeSize: type: integer - minNodeSize: + example: 3 + MinNodeSize: type: integer - nodes: + example: 1 + Nodes: type: array items: $ref: '#/components/schemas/model.IID' - onAutoScaling: + OnAutoScaling: type: boolean description: Scaling config. - rootDiskSize: + example: true + RootDiskSize: type: string description: "\"\", \"default\", \"50\", \"1000\" (GB)" - rootDiskType: + example: "50" + RootDiskType: type: string description: "\"SSD(gp2)\", \"Premium SSD\", ..." - status: - $ref: '#/components/schemas/model.SpiderNodeGroupStatus' - vmspecName: + Status: + type: object + example: Active + allOf: + - $ref: '#/components/schemas/model.SpiderNodeGroupStatus' + VMSpecName: type: string + example: t3.medium model.SpiderNodeGroupStatus: type: string enum: