From 810fbe2cc14380434516e4df6dd8cca8a447357a Mon Sep 17 00:00:00 2001 From: cb-github-robot Date: Wed, 13 Dec 2023 14:00:38 +0000 Subject: [PATCH] Update Swagger REST API doc --- pkg/api/rest/docs/docs.go | 178 ++++++++++++++++++++++++++++++--- pkg/api/rest/docs/swagger.json | 178 ++++++++++++++++++++++++++++++--- pkg/api/rest/docs/swagger.yaml | 119 ++++++++++++++++++++-- 3 files changed, 440 insertions(+), 35 deletions(-) diff --git a/pkg/api/rest/docs/docs.go b/pkg/api/rest/docs/docs.go index 034125a..3de9109 100644 --- a/pkg/api/rest/docs/docs.go +++ b/pkg/api/rest/docs/docs.go @@ -1517,19 +1517,7 @@ const docTemplate = `{ "type": "object", "properties": { "compute": { - "type": "string" - }, - "disk": { - "type": "string" - }, - "network": { - "type": "string" - }, - "securityGroup": { - "type": "string" - }, - "virtualMachine": { - "type": "string" + "$ref": "#/definitions/infra.Compute" } } }, @@ -1581,6 +1569,170 @@ const docTemplate = `{ } } }, + "infra.CPU": { + "type": "object", + "properties": { + "cache": { + "description": "KB", + "type": "integer" + }, + "cores": { + "description": "ea", + "type": "integer" + }, + "cpus": { + "description": "ea", + "type": "integer" + }, + "model": { + "type": "string" + }, + "speed": { + "description": "MHz", + "type": "integer" + }, + "threads": { + "description": "ea", + "type": "integer" + }, + "vendor": { + "type": "string" + } + } + }, + "infra.Compute": { + "type": "object", + "properties": { + "compute_resource": { + "$ref": "#/definitions/infra.ComputeResource" + }, + "os": { + "$ref": "#/definitions/infra.System" + } + } + }, + "infra.ComputeResource": { + "type": "object", + "properties": { + "cpu": { + "$ref": "#/definitions/infra.CPU" + }, + "memory": { + "$ref": "#/definitions/infra.Memory" + }, + "storage": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Storage" + } + } + } + }, + "infra.Kernel": { + "type": "object", + "properties": { + "architecture": { + "type": "string" + }, + "release": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "infra.Memory": { + "type": "object", + "properties": { + "size": { + "description": "MB", + "type": "integer" + }, + "speed": { + "description": "MHz", + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "infra.Node": { + "type": "object", + "properties": { + "hostname": { + "type": "string" + }, + "hypervisor": { + "type": "string" + }, + "machineid": { + "type": "string" + }, + "timezone": { + "type": "string" + } + } + }, + "infra.OS": { + "type": "object", + "properties": { + "architecture": { + "type": "string" + }, + "name": { + "type": "string" + }, + "release": { + "type": "string" + }, + "vendor": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "infra.Storage": { + "type": "object", + "properties": { + "driver": { + "type": "string" + }, + "model": { + "type": "string" + }, + "name": { + "type": "string" + }, + "serial": { + "type": "string" + }, + "size": { + "description": "GB", + "type": "integer" + }, + "vendor": { + "type": "string" + } + } + }, + "infra.System": { + "type": "object", + "properties": { + "kernel": { + "$ref": "#/definitions/infra.Kernel" + }, + "node": { + "$ref": "#/definitions/infra.Node" + }, + "os": { + "$ref": "#/definitions/infra.OS" + } + } + }, "model.MyUser": { "type": "object", "properties": { diff --git a/pkg/api/rest/docs/swagger.json b/pkg/api/rest/docs/swagger.json index a35e38b..42a7640 100644 --- a/pkg/api/rest/docs/swagger.json +++ b/pkg/api/rest/docs/swagger.json @@ -1510,19 +1510,7 @@ "type": "object", "properties": { "compute": { - "type": "string" - }, - "disk": { - "type": "string" - }, - "network": { - "type": "string" - }, - "securityGroup": { - "type": "string" - }, - "virtualMachine": { - "type": "string" + "$ref": "#/definitions/infra.Compute" } } }, @@ -1574,6 +1562,170 @@ } } }, + "infra.CPU": { + "type": "object", + "properties": { + "cache": { + "description": "KB", + "type": "integer" + }, + "cores": { + "description": "ea", + "type": "integer" + }, + "cpus": { + "description": "ea", + "type": "integer" + }, + "model": { + "type": "string" + }, + "speed": { + "description": "MHz", + "type": "integer" + }, + "threads": { + "description": "ea", + "type": "integer" + }, + "vendor": { + "type": "string" + } + } + }, + "infra.Compute": { + "type": "object", + "properties": { + "compute_resource": { + "$ref": "#/definitions/infra.ComputeResource" + }, + "os": { + "$ref": "#/definitions/infra.System" + } + } + }, + "infra.ComputeResource": { + "type": "object", + "properties": { + "cpu": { + "$ref": "#/definitions/infra.CPU" + }, + "memory": { + "$ref": "#/definitions/infra.Memory" + }, + "storage": { + "type": "array", + "items": { + "$ref": "#/definitions/infra.Storage" + } + } + } + }, + "infra.Kernel": { + "type": "object", + "properties": { + "architecture": { + "type": "string" + }, + "release": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "infra.Memory": { + "type": "object", + "properties": { + "size": { + "description": "MB", + "type": "integer" + }, + "speed": { + "description": "MHz", + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "infra.Node": { + "type": "object", + "properties": { + "hostname": { + "type": "string" + }, + "hypervisor": { + "type": "string" + }, + "machineid": { + "type": "string" + }, + "timezone": { + "type": "string" + } + } + }, + "infra.OS": { + "type": "object", + "properties": { + "architecture": { + "type": "string" + }, + "name": { + "type": "string" + }, + "release": { + "type": "string" + }, + "vendor": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, + "infra.Storage": { + "type": "object", + "properties": { + "driver": { + "type": "string" + }, + "model": { + "type": "string" + }, + "name": { + "type": "string" + }, + "serial": { + "type": "string" + }, + "size": { + "description": "GB", + "type": "integer" + }, + "vendor": { + "type": "string" + } + } + }, + "infra.System": { + "type": "object", + "properties": { + "kernel": { + "$ref": "#/definitions/infra.Kernel" + }, + "node": { + "$ref": "#/definitions/infra.Node" + }, + "os": { + "$ref": "#/definitions/infra.OS" + } + } + }, "model.MyUser": { "type": "object", "properties": { diff --git a/pkg/api/rest/docs/swagger.yaml b/pkg/api/rest/docs/swagger.yaml index f0b9d40..8216869 100644 --- a/pkg/api/rest/docs/swagger.yaml +++ b/pkg/api/rest/docs/swagger.yaml @@ -341,15 +341,7 @@ definitions: controller.RecommendInfraRequest: properties: compute: - type: string - disk: - type: string - network: - type: string - securityGroup: - type: string - virtualMachine: - type: string + $ref: '#/definitions/infra.Compute' type: object controller.RecommendInfraResponse: properties: @@ -382,6 +374,115 @@ definitions: name: type: string type: object + infra.CPU: + properties: + cache: + description: KB + type: integer + cores: + description: ea + type: integer + cpus: + description: ea + type: integer + model: + type: string + speed: + description: MHz + type: integer + threads: + description: ea + type: integer + vendor: + type: string + type: object + infra.Compute: + properties: + compute_resource: + $ref: '#/definitions/infra.ComputeResource' + os: + $ref: '#/definitions/infra.System' + type: object + infra.ComputeResource: + properties: + cpu: + $ref: '#/definitions/infra.CPU' + memory: + $ref: '#/definitions/infra.Memory' + storage: + items: + $ref: '#/definitions/infra.Storage' + type: array + type: object + infra.Kernel: + properties: + architecture: + type: string + release: + type: string + version: + type: string + type: object + infra.Memory: + properties: + size: + description: MB + type: integer + speed: + description: MHz + type: integer + type: + type: string + type: object + infra.Node: + properties: + hostname: + type: string + hypervisor: + type: string + machineid: + type: string + timezone: + type: string + type: object + infra.OS: + properties: + architecture: + type: string + name: + type: string + release: + type: string + vendor: + type: string + version: + type: string + type: object + infra.Storage: + properties: + driver: + type: string + model: + type: string + name: + type: string + serial: + type: string + size: + description: GB + type: integer + vendor: + type: string + type: object + infra.System: + properties: + kernel: + $ref: '#/definitions/infra.Kernel' + node: + $ref: '#/definitions/infra.Node' + os: + $ref: '#/definitions/infra.OS' + type: object model.MyUser: properties: email: