From 0e56c86e16f96f32c9b33a822a917ce4d60db753 Mon Sep 17 00:00:00 2001 From: ish Date: Thu, 30 May 2024 16:00:08 +0900 Subject: [PATCH] api: rest: Update Swagger document --- server/pkg/api/rest/docs/docs.go | 195 ++++++++++++++------------ server/pkg/api/rest/docs/swagger.json | 195 ++++++++++++++------------ server/pkg/api/rest/docs/swagger.yaml | 135 ++++++++++-------- 3 files changed, 294 insertions(+), 231 deletions(-) diff --git a/server/pkg/api/rest/docs/docs.go b/server/pkg/api/rest/docs/docs.go index b5371be..833b172 100644 --- a/server/pkg/api/rest/docs/docs.go +++ b/server/pkg/api/rest/docs/docs.go @@ -760,23 +760,6 @@ const docTemplate = `{ } }, "definitions": { - "drm.DRM": { - "type": "object", - "properties": { - "driver_date": { - "type": "string" - }, - "driver_description": { - "type": "string" - }, - "driver_name": { - "type": "string" - }, - "driver_version": { - "type": "string" - } - } - }, "github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse": { "type": "object", "properties": { @@ -889,6 +872,11 @@ const docTemplate = `{ }, "infra.CPU": { "type": "object", + "required": [ + "cores", + "cpus", + "threads" + ], "properties": { "cache": { "description": "KB", @@ -920,6 +908,10 @@ const docTemplate = `{ }, "infra.Compute": { "type": "object", + "required": [ + "compute_resource", + "os" + ], "properties": { "compute_resource": { "$ref": "#/definitions/infra.ComputeResource" @@ -937,6 +929,10 @@ const docTemplate = `{ }, "infra.ComputeResource": { "type": "object", + "required": [ + "cpu", + "memory" + ], "properties": { "cpu": { "$ref": "#/definitions/infra.CPU" @@ -963,6 +959,23 @@ const docTemplate = `{ } } }, + "infra.DRM": { + "type": "object", + "properties": { + "driver_date": { + "type": "string" + }, + "driver_description": { + "type": "string" + }, + "driver_name": { + "type": "string" + }, + "driver_version": { + "type": "string" + } + } + }, "infra.Disk": { "type": "object", "properties": { @@ -984,13 +997,13 @@ const docTemplate = `{ "drm": { "type": "array", "items": { - "$ref": "#/definitions/drm.DRM" + "$ref": "#/definitions/infra.DRM" } }, "nvidia": { "type": "array", "items": { - "$ref": "#/definitions/nvidia.NVIDIA" + "$ref": "#/definitions/infra.NVIDIA" } } } @@ -1042,6 +1055,9 @@ const docTemplate = `{ }, "infra.Memory": { "type": "object", + "required": [ + "size" + ], "properties": { "size": { "description": "MB", @@ -1084,6 +1100,73 @@ const docTemplate = `{ } } }, + "infra.NVIDIA": { + "type": "object", + "properties": { + "device_attribute": { + "$ref": "#/definitions/infra.NVIDIADeviceAttribute" + }, + "performance": { + "$ref": "#/definitions/infra.NVIDIAPerformance" + } + } + }, + "infra.NVIDIADeviceAttribute": { + "type": "object", + "properties": { + "cuda_version": { + "type": "string" + }, + "driver_version": { + "type": "string" + }, + "gpu_uuid": { + "type": "string" + }, + "product_architecture": { + "type": "string" + }, + "product_brand": { + "type": "string" + }, + "product_name": { + "type": "string" + } + } + }, + "infra.NVIDIAPerformance": { + "type": "object", + "properties": { + "bar1_memory_total": { + "description": "mb", + "type": "integer" + }, + "bar1_memory_usage": { + "description": "percent", + "type": "integer" + }, + "bar1_memory_used": { + "description": "mb", + "type": "integer" + }, + "fb_memory_total": { + "description": "mb", + "type": "integer" + }, + "fb_memory_usage": { + "description": "percent", + "type": "integer" + }, + "fb_memory_used": { + "description": "mb", + "type": "integer" + }, + "gpu_usage": { + "description": "percent", + "type": "integer" + } + } + }, "infra.Node": { "type": "object", "properties": { @@ -1103,6 +1186,10 @@ const docTemplate = `{ }, "infra.OS": { "type": "object", + "required": [ + "release", + "vendor" + ], "properties": { "architecture": { "type": "string" @@ -1131,6 +1218,9 @@ const docTemplate = `{ }, "infra.System": { "type": "object", + "required": [ + "os" + ], "properties": { "kernel": { "$ref": "#/definitions/infra.Kernel" @@ -1504,73 +1594,6 @@ const docTemplate = `{ } } }, - "nvidia.DeviceAttribute": { - "type": "object", - "properties": { - "cuda_version": { - "type": "string" - }, - "driver_version": { - "type": "string" - }, - "gpu_uuid": { - "type": "string" - }, - "product_architecture": { - "type": "string" - }, - "product_brand": { - "type": "string" - }, - "product_name": { - "type": "string" - } - } - }, - "nvidia.NVIDIA": { - "type": "object", - "properties": { - "device_attribute": { - "$ref": "#/definitions/nvidia.DeviceAttribute" - }, - "performance": { - "$ref": "#/definitions/nvidia.Performance" - } - } - }, - "nvidia.Performance": { - "type": "object", - "properties": { - "bar1_memory_total": { - "description": "mb", - "type": "integer" - }, - "bar1_memory_usage": { - "description": "percent", - "type": "integer" - }, - "bar1_memory_used": { - "description": "mb", - "type": "integer" - }, - "fb_memory_total": { - "description": "mb", - "type": "integer" - }, - "fb_memory_usage": { - "description": "percent", - "type": "integer" - }, - "fb_memory_used": { - "description": "mb", - "type": "integer" - }, - "gpu_usage": { - "description": "percent", - "type": "integer" - } - } - }, "pkg_api_rest_controller.SimpleMsg": { "type": "object", "properties": { diff --git a/server/pkg/api/rest/docs/swagger.json b/server/pkg/api/rest/docs/swagger.json index d8b6ab1..46ff6ad 100644 --- a/server/pkg/api/rest/docs/swagger.json +++ b/server/pkg/api/rest/docs/swagger.json @@ -749,23 +749,6 @@ } }, "definitions": { - "drm.DRM": { - "type": "object", - "properties": { - "driver_date": { - "type": "string" - }, - "driver_description": { - "type": "string" - }, - "driver_name": { - "type": "string" - }, - "driver_version": { - "type": "string" - } - } - }, "github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse": { "type": "object", "properties": { @@ -878,6 +861,11 @@ }, "infra.CPU": { "type": "object", + "required": [ + "cores", + "cpus", + "threads" + ], "properties": { "cache": { "description": "KB", @@ -909,6 +897,10 @@ }, "infra.Compute": { "type": "object", + "required": [ + "compute_resource", + "os" + ], "properties": { "compute_resource": { "$ref": "#/definitions/infra.ComputeResource" @@ -926,6 +918,10 @@ }, "infra.ComputeResource": { "type": "object", + "required": [ + "cpu", + "memory" + ], "properties": { "cpu": { "$ref": "#/definitions/infra.CPU" @@ -952,6 +948,23 @@ } } }, + "infra.DRM": { + "type": "object", + "properties": { + "driver_date": { + "type": "string" + }, + "driver_description": { + "type": "string" + }, + "driver_name": { + "type": "string" + }, + "driver_version": { + "type": "string" + } + } + }, "infra.Disk": { "type": "object", "properties": { @@ -973,13 +986,13 @@ "drm": { "type": "array", "items": { - "$ref": "#/definitions/drm.DRM" + "$ref": "#/definitions/infra.DRM" } }, "nvidia": { "type": "array", "items": { - "$ref": "#/definitions/nvidia.NVIDIA" + "$ref": "#/definitions/infra.NVIDIA" } } } @@ -1031,6 +1044,9 @@ }, "infra.Memory": { "type": "object", + "required": [ + "size" + ], "properties": { "size": { "description": "MB", @@ -1073,6 +1089,73 @@ } } }, + "infra.NVIDIA": { + "type": "object", + "properties": { + "device_attribute": { + "$ref": "#/definitions/infra.NVIDIADeviceAttribute" + }, + "performance": { + "$ref": "#/definitions/infra.NVIDIAPerformance" + } + } + }, + "infra.NVIDIADeviceAttribute": { + "type": "object", + "properties": { + "cuda_version": { + "type": "string" + }, + "driver_version": { + "type": "string" + }, + "gpu_uuid": { + "type": "string" + }, + "product_architecture": { + "type": "string" + }, + "product_brand": { + "type": "string" + }, + "product_name": { + "type": "string" + } + } + }, + "infra.NVIDIAPerformance": { + "type": "object", + "properties": { + "bar1_memory_total": { + "description": "mb", + "type": "integer" + }, + "bar1_memory_usage": { + "description": "percent", + "type": "integer" + }, + "bar1_memory_used": { + "description": "mb", + "type": "integer" + }, + "fb_memory_total": { + "description": "mb", + "type": "integer" + }, + "fb_memory_usage": { + "description": "percent", + "type": "integer" + }, + "fb_memory_used": { + "description": "mb", + "type": "integer" + }, + "gpu_usage": { + "description": "percent", + "type": "integer" + } + } + }, "infra.Node": { "type": "object", "properties": { @@ -1092,6 +1175,10 @@ }, "infra.OS": { "type": "object", + "required": [ + "release", + "vendor" + ], "properties": { "architecture": { "type": "string" @@ -1120,6 +1207,9 @@ }, "infra.System": { "type": "object", + "required": [ + "os" + ], "properties": { "kernel": { "$ref": "#/definitions/infra.Kernel" @@ -1493,73 +1583,6 @@ } } }, - "nvidia.DeviceAttribute": { - "type": "object", - "properties": { - "cuda_version": { - "type": "string" - }, - "driver_version": { - "type": "string" - }, - "gpu_uuid": { - "type": "string" - }, - "product_architecture": { - "type": "string" - }, - "product_brand": { - "type": "string" - }, - "product_name": { - "type": "string" - } - } - }, - "nvidia.NVIDIA": { - "type": "object", - "properties": { - "device_attribute": { - "$ref": "#/definitions/nvidia.DeviceAttribute" - }, - "performance": { - "$ref": "#/definitions/nvidia.Performance" - } - } - }, - "nvidia.Performance": { - "type": "object", - "properties": { - "bar1_memory_total": { - "description": "mb", - "type": "integer" - }, - "bar1_memory_usage": { - "description": "percent", - "type": "integer" - }, - "bar1_memory_used": { - "description": "mb", - "type": "integer" - }, - "fb_memory_total": { - "description": "mb", - "type": "integer" - }, - "fb_memory_usage": { - "description": "percent", - "type": "integer" - }, - "fb_memory_used": { - "description": "mb", - "type": "integer" - }, - "gpu_usage": { - "description": "percent", - "type": "integer" - } - } - }, "pkg_api_rest_controller.SimpleMsg": { "type": "object", "properties": { diff --git a/server/pkg/api/rest/docs/swagger.yaml b/server/pkg/api/rest/docs/swagger.yaml index 02fcbcf..423561e 100644 --- a/server/pkg/api/rest/docs/swagger.yaml +++ b/server/pkg/api/rest/docs/swagger.yaml @@ -1,15 +1,4 @@ definitions: - drm.DRM: - properties: - driver_date: - type: string - driver_description: - type: string - driver_name: - type: string - driver_version: - type: string - type: object github_com_cloud-barista_cm-honeybee_server_pkg_api_rest_common.ErrorResponse: properties: error: @@ -105,6 +94,10 @@ definitions: type: integer vendor: type: string + required: + - cores + - cpus + - threads type: object infra.Compute: properties: @@ -116,6 +109,9 @@ definitions: type: array os: $ref: '#/definitions/infra.System' + required: + - compute_resource + - os type: object infra.ComputeResource: properties: @@ -129,12 +125,26 @@ definitions: $ref: '#/definitions/infra.Memory' root_disk: $ref: '#/definitions/infra.Disk' + required: + - cpu + - memory type: object infra.Connection: properties: keypair: $ref: '#/definitions/infra.Keypair' type: object + infra.DRM: + properties: + driver_date: + type: string + driver_description: + type: string + driver_name: + type: string + driver_version: + type: string + type: object infra.Disk: properties: label: @@ -149,11 +159,11 @@ definitions: properties: drm: items: - $ref: '#/definitions/drm.DRM' + $ref: '#/definitions/infra.DRM' type: array nvidia: items: - $ref: '#/definitions/nvidia.NVIDIA' + $ref: '#/definitions/infra.NVIDIA' type: array type: object infra.Infra: @@ -195,6 +205,8 @@ definitions: type: integer type: type: string + required: + - size type: object infra.MountPoint: properties: @@ -214,6 +226,52 @@ definitions: source: type: string type: object + infra.NVIDIA: + properties: + device_attribute: + $ref: '#/definitions/infra.NVIDIADeviceAttribute' + performance: + $ref: '#/definitions/infra.NVIDIAPerformance' + type: object + infra.NVIDIADeviceAttribute: + properties: + cuda_version: + type: string + driver_version: + type: string + gpu_uuid: + type: string + product_architecture: + type: string + product_brand: + type: string + product_name: + type: string + type: object + infra.NVIDIAPerformance: + properties: + bar1_memory_total: + description: mb + type: integer + bar1_memory_usage: + description: percent + type: integer + bar1_memory_used: + description: mb + type: integer + fb_memory_total: + description: mb + type: integer + fb_memory_usage: + description: percent + type: integer + fb_memory_used: + description: mb + type: integer + gpu_usage: + description: percent + type: integer + type: object infra.Node: properties: hostname: @@ -237,6 +295,9 @@ definitions: type: string version: type: string + required: + - release + - vendor type: object infra.Storage: properties: @@ -251,6 +312,8 @@ definitions: $ref: '#/definitions/infra.Node' os: $ref: '#/definitions/infra.OS' + required: + - os type: object mount.Propagation: enum: @@ -503,52 +566,6 @@ definitions: $ref: '#/definitions/network.Subnet' type: array type: object - nvidia.DeviceAttribute: - properties: - cuda_version: - type: string - driver_version: - type: string - gpu_uuid: - type: string - product_architecture: - type: string - product_brand: - type: string - product_name: - type: string - type: object - nvidia.NVIDIA: - properties: - device_attribute: - $ref: '#/definitions/nvidia.DeviceAttribute' - performance: - $ref: '#/definitions/nvidia.Performance' - type: object - nvidia.Performance: - properties: - bar1_memory_total: - description: mb - type: integer - bar1_memory_usage: - description: percent - type: integer - bar1_memory_used: - description: mb - type: integer - fb_memory_total: - description: mb - type: integer - fb_memory_usage: - description: percent - type: integer - fb_memory_used: - description: mb - type: integer - gpu_usage: - description: percent - type: integer - type: object pkg_api_rest_controller.SimpleMsg: properties: message: