diff --git a/docs/api/swagger.json b/docs/api/swagger.json index 98bbf24..626f47a 100644 --- a/docs/api/swagger.json +++ b/docs/api/swagger.json @@ -265,7 +265,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtSortDir" + "$ref": "#/components/schemas/SortDir" }, "name": "sort_dirs", "in": "query" @@ -275,7 +275,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtServerSortKey" + "$ref": "#/components/schemas/ServerSortKey" } }, "name": "sort_keys", @@ -324,7 +324,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtServerStatus" + "$ref": "#/components/schemas/ServerStatus" }, "name": "status", "in": "query" @@ -378,7 +378,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListServersResponse" + "$ref": "#/components/schemas/ServersResponse" } } } @@ -467,7 +467,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtSortDir" + "$ref": "#/components/schemas/SortDir" }, "name": "sort_dirs", "in": "query" @@ -477,7 +477,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtRecycleServerSortKey" + "$ref": "#/components/schemas/RecycleServerSortKey" } }, "name": "sort_keys", @@ -552,7 +552,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListRecycleServersResponse" + "$ref": "#/components/schemas/RecycleServersResponse" } } } @@ -641,7 +641,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtSortDir" + "$ref": "#/components/schemas/SortDir" }, "name": "sort_dirs", "in": "query" @@ -651,7 +651,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtVolumeSortKey" + "$ref": "#/components/schemas/VolumeSortKey" } }, "name": "sort_keys", @@ -696,7 +696,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtVolumeStatus" + "$ref": "#/components/schemas/VolumeStatus" }, "name": "status", "in": "query" @@ -742,7 +742,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListVolumesResponse" + "$ref": "#/components/schemas/VolumesResponse" } } } @@ -821,7 +821,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtSortDir" + "$ref": "#/components/schemas/SortDir" }, "name": "sort_dirs", "in": "query" @@ -831,7 +831,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtVolumeSnapshotSortKey" + "$ref": "#/components/schemas/VolumeSnapshotSortKey" } }, "name": "sort_keys", @@ -867,7 +867,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtVolumeSnapshotStatus" + "$ref": "#/components/schemas/VolumeSnapshotStatus" }, "name": "status", "in": "query" @@ -899,7 +899,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListVolumeSnapshotsResponse" + "$ref": "#/components/schemas/VolumeSnapshotsResponse" } } } @@ -978,7 +978,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtSortDir" + "$ref": "#/components/schemas/SortDir" }, "name": "sort_dirs", "in": "query" @@ -988,7 +988,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtPortSortKey" + "$ref": "#/components/schemas/PortSortKey" } }, "name": "sort_keys", @@ -1024,7 +1024,7 @@ { "required": false, "schema": { - "$ref": "#/components/schemas/ExtPortStatus" + "$ref": "#/components/schemas/PortStatus" }, "name": "status", "in": "query" @@ -1061,7 +1061,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/ExtPortDeviceOwner" + "$ref": "#/components/schemas/PortDeviceOwner" } }, "name": "device_owner", @@ -1099,7 +1099,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListPortsResponse" + "$ref": "#/components/schemas/PortsResponse" } } } @@ -1192,7 +1192,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ExtListComputeServicesResponse" + "$ref": "#/components/schemas/ComputeServicesResponse" } } } @@ -1903,6 +1903,79 @@ } } }, + "ComputeServicesResponse": { + "title": "ComputeServicesResponse", + "required": [ + "services" + ], + "type": "object", + "properties": { + "services": { + "title": "Services", + "type": "array", + "items": { + "$ref": "#/components/schemas/ComputeServicesResponseBase" + }, + "description": "Services list" + } + } + }, + "ComputeServicesResponseBase": { + "title": "ComputeServicesResponseBase", + "required": [ + "binary", + "host", + "status" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "Service id" + }, + "binary": { + "title": "Binary", + "type": "string", + "description": "Service binary" + }, + "disabled_reason": { + "title": "Disabled Reason", + "type": "string", + "description": "Disabled reason" + }, + "host": { + "title": "Host", + "type": "string", + "description": "Host name" + }, + "state": { + "title": "State", + "type": "string", + "description": "Service state" + }, + "status": { + "title": "Status", + "type": "string", + "description": "Service status" + }, + "updated_at": { + "title": "Updated At", + "type": "string", + "description": "Updated at" + }, + "forced_down": { + "title": "Forced Down", + "type": "boolean", + "description": "Forced down" + }, + "zone": { + "title": "Zone", + "type": "string", + "description": "Zone" + } + } + }, "Credential": { "title": "Credential", "required": [ @@ -1961,898 +2034,47 @@ } } }, - "ExtFlavor": { - "title": "ExtFlavor", + "FlavorInServer": { + "title": "FlavorInServer", "type": "object", "properties": { "ephemeral": { "title": "Ephemeral", - "type": "integer" + "type": "integer", + "description": "Ephemeral disk size in GB" }, "ram": { "title": "Ram", - "type": "integer" + "type": "integer", + "description": "RAM size in MB" }, "original_name": { "title": "Original Name", - "type": "string" + "type": "string", + "description": "Original flavor name" }, "vcpus": { "title": "Vcpus", - "type": "integer" + "type": "integer", + "description": "Number of vCPUs" }, "extra_specs": { "title": "Extra Specs", - "type": "object" + "type": "object", + "description": "Extra specs" }, "swap": { "title": "Swap", - "type": "integer" + "type": "integer", + "description": "Swap size in MB" }, "disk": { "title": "Disk", - "type": "integer" - } - } - }, - "ExtListComputeServicesBaseResponse": { - "title": "ExtListComputeServicesBaseResponse", - "required": [ - "binary", - "host", - "status" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "binary": { - "title": "Binary", - "type": "string" - }, - "disabled_reason": { - "title": "Disabled Reason", - "type": "string" - }, - "host": { - "title": "Host", - "type": "string" - }, - "state": { - "title": "State", - "type": "string" - }, - "status": { - "title": "Status", - "type": "string" - }, - "updated_at": { - "title": "Updated At", - "type": "string" - }, - "forced_down": { - "title": "Forced Down", - "type": "boolean" - }, - "zone": { - "title": "Zone", - "type": "string" - } - } - }, - "ExtListComputeServicesResponse": { - "title": "ExtListComputeServicesResponse", - "required": [ - "services" - ], - "type": "object", - "properties": { - "services": { - "title": "Services", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListComputeServicesBaseResponse" - } - } - } - }, - "ExtListPortsBaseResponse": { - "title": "ExtListPortsBaseResponse", - "required": [ - "id", - "origin_data" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "origin_data": { - "title": "Origin Data", - "type": "object", - "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#list-ports" - }, - "server_name": { - "title": "Server Name", - "type": "string" - }, - "network_name": { - "title": "Network Name", - "type": "string" - }, - "ipv4": { - "title": "Ipv4", - "type": "array", - "items": {} - }, - "ipv6": { - "title": "Ipv6", - "type": "array", - "items": {} - }, - "name": { - "title": "Name", - "type": "string", - "description": "Will be removed, please use origin_data[name]", - "deprecated": true - }, - "mac_address": { - "title": "Mac Address", - "type": "string", - "description": "Will be removed, please use origin_data[mac_address]", - "deprecated": true - }, - "project_id": { - "title": "Project Id", - "type": "string", - "description": "Will be removed, please use origin_data[project_id]", - "deprecated": true - }, - "device_owner": { - "title": "Device Owner", - "type": "string", - "description": "Will be removed, please use origin_data[device_owner]", - "deprecated": true - }, - "device_id": { - "title": "Device Id", - "type": "string", - "description": "Will be removed, please use origin_data[device_id]", - "deprecated": true - }, - "status": { - "title": "Status", - "type": "string", - "description": "Will be removed, please use origin_data[status]", - "deprecated": true - }, - "created_at": { - "title": "Created At", - "type": "string", - "description": "Will be removed, please use origin_data[created_at]", - "deprecated": true - }, - "network_id": { - "title": "Network Id", - "type": "string", - "description": "Will be removed, please use origin_data[network_id]", - "deprecated": true - }, - "binding_vnic_type": { - "title": "Binding Vnic Type", - "type": "string", - "description": "Will be removed, please use origin_data[binding:vnic_type]", - "deprecated": true - }, - "description": { - "title": "Description", - "type": "string", - "description": "Will be removed, please use origin_data[description]", - "deprecated": true - }, - "port_security_enabled": { - "title": "Port Security Enabled", - "type": "boolean", - "description": "Will be removed, please use origin_data[port_security_enabled]", - "deprecated": true - }, - "qos_policy_id": { - "title": "Qos Policy Id", - "type": "string", - "description": "Will be removed, please use origin_data[qos_policy_id]", - "deprecated": true - }, - "fixed_ips": { - "title": "Fixed Ips", - "type": "array", - "items": {}, - "description": "Will be removed, please use origin_data[fixed_ips]", - "deprecated": true - } - } - }, - "ExtListPortsResponse": { - "title": "ExtListPortsResponse", - "required": [ - "ports" - ], - "type": "object", - "properties": { - "ports": { - "title": "Ports", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListPortsBaseResponse" - } - } - } - }, - "ExtListRecycleServersBaseResponse": { - "title": "ExtListRecycleServersBaseResponse", - "required": [ - "id", - "origin_data", - "reclaim_timestamp" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string", - "format": "uuid4" - }, - "origin_data": { - "title": "Origin Data", - "type": "object", - "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#list-servers-detailed" - }, - "project_name": { - "title": "Project Name", - "type": "string" - }, - "image": { - "title": "Image", - "type": "string", - "format": "uuid4" - }, - "image_name": { - "title": "Image Name", - "type": "string" - }, - "image_os_distro": { - "title": "Image Os Distro", - "type": "string" - }, - "fixed_addresses": { - "title": "Fixed Addresses", - "type": "array", - "items": {} - }, - "floating_addresses": { - "title": "Floating Addresses", - "type": "array", - "items": {} - }, - "deleted_at": { - "title": "Deleted At", - "type": "string" - }, - "reclaim_timestamp": { - "title": "Reclaim Timestamp", - "type": "number" - }, - "name": { - "title": "Name", - "type": "string", - "description": "Will be removed, please use origin_data[name]", - "deprecated": true - }, - "project_id": { - "title": "Project Id", - "type": "string", - "description": "Will be removed, please use origin_data[tenant_id]", - "deprecated": true - }, - "host": { - "title": "Host", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:host]", - "deprecated": true - }, - "hostname": { - "title": "Hostname", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:hostname]", - "deprecated": true - }, - "flavor": { - "title": "Flavor", - "type": "string", - "description": "Will be removed, please use origin_data[flavor][original_name]", - "deprecated": true - }, - "flavor_info": { - "title": "Flavor Info", - "allOf": [ - { - "$ref": "#/components/schemas/ExtFlavor" - } - ], - "description": "Will be removed, please use origin_data[flavor]", - "deprecated": true - }, - "status": { - "title": "Status", - "type": "string", - "description": "Will be removed, please use origin_data[status]", - "deprecated": true - } - } - }, - "ExtListRecycleServersResponse": { - "title": "ExtListRecycleServersResponse", - "required": [ - "recycle_servers" - ], - "type": "object", - "properties": { - "recycle_servers": { - "title": "Recycle Servers", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListRecycleServersBaseResponse" - } - } - } - }, - "ExtListServersBaseResponse": { - "title": "ExtListServersBaseResponse", - "required": [ - "id", - "origin_data" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string", - "format": "uuid4" - }, - "origin_data": { - "title": "Origin Data", - "type": "object", - "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#list-servers-detailed" - }, - "project_name": { - "title": "Project Name", - "type": "string" - }, - "image": { - "title": "Image", - "type": "string", - "format": "uuid4" - }, - "image_name": { - "title": "Image Name", - "type": "string" - }, - "image_os_distro": { - "title": "Image Os Distro", - "type": "string" - }, - "fixed_addresses": { - "title": "Fixed Addresses", - "type": "array", - "items": {} - }, - "floating_addresses": { - "title": "Floating Addresses", - "type": "array", - "items": {} - }, - "name": { - "title": "Name", - "type": "string", - "description": "Will be removed, please use origin_data[name]", - "deprecated": true - }, - "project_id": { - "title": "Project Id", - "type": "string", - "description": "Will be removed, please use origin_data[tenant_id]", - "deprecated": true - }, - "host": { - "title": "Host", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:host]", - "deprecated": true - }, - "hostname": { - "title": "Hostname", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:hostname]", - "deprecated": true - }, - "flavor": { - "title": "Flavor", - "type": "string", - "description": "Will be removed, please use origin_data[flavor][original_name]", - "deprecated": true - }, - "flavor_info": { - "title": "Flavor Info", - "allOf": [ - { - "$ref": "#/components/schemas/ExtFlavor" - } - ], - "description": "Will be removed, please use origin_data[flavor]", - "deprecated": true - }, - "status": { - "title": "Status", - "type": "string", - "description": "Will be removed, please use origin_data[status]", - "deprecated": true - }, - "locked": { - "title": "Locked", - "type": "boolean", - "description": "Will be removed, please use origin_data[locked]", - "deprecated": true - }, - "created_at": { - "title": "Created At", - "type": "string", - "description": "Will be removed, please use origin_data[created]", - "deprecated": true - }, - "task_state": { - "title": "Task State", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-STS:task_state]", - "deprecated": true - }, - "vm_state": { - "title": "Vm State", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-STS:vm_state]", - "deprecated": true - }, - "power_state": { - "title": "Power State", "type": "integer", - "description": "Will be removed, please use origin_data[OS-EXT-STS:power_state]", - "deprecated": true - }, - "root_device_name": { - "title": "Root Device Name", - "type": "string", - "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:root_device_name]", - "deprecated": true - }, - "metadata": { - "title": "Metadata", - "type": "object", - "description": "Will be removed, please use origin_data[metadata]", - "deprecated": true + "description": "Disk size in GB" } } }, - "ExtListServersResponse": { - "title": "ExtListServersResponse", - "required": [ - "servers" - ], - "type": "object", - "properties": { - "servers": { - "title": "Servers", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListServersBaseResponse" - } - } - } - }, - "ExtListVolumeSnapshotsBaseResponse": { - "title": "ExtListVolumeSnapshotsBaseResponse", - "required": [ - "id", - "origin_data" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string" - }, - "origin_data": { - "title": "Origin Data", - "type": "object", - "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=list-snapshots-and-details-detail#list-snapshots-and-details" - }, - "project_name": { - "title": "Project Name", - "type": "string" - }, - "host": { - "title": "Host", - "type": "string" - }, - "volume_name": { - "title": "Volume Name", - "type": "string" - }, - "child_volumes": { - "title": "Child Volumes", - "type": "array", - "items": {} - }, - "name": { - "title": "Name", - "type": "string", - "description": "Will be removed, please use origin_data[name]", - "deprecated": true - }, - "project_id": { - "title": "Project Id", - "type": "string", - "description": "Will be removed, please use origin_data[os-extended-snapshot-attributes:project_id]", - "deprecated": true - }, - "size": { - "title": "Size", - "type": "integer", - "description": "Will be removed, please use origin_data[size]", - "deprecated": true - }, - "status": { - "title": "Status", - "type": "string", - "description": "Will be removed, please use origin_data[status]", - "deprecated": true - }, - "volume_id": { - "title": "Volume Id", - "type": "string", - "description": "Will be removed, please use origin_data[volume_id]", - "deprecated": true - }, - "created_at": { - "title": "Created At", - "type": "string", - "description": "Will be removed, please use origin_data[created_at]", - "deprecated": true - }, - "metadata": { - "title": "Metadata", - "type": "object", - "description": "Will be removed, please use origin_data[metadata]", - "deprecated": true - } - } - }, - "ExtListVolumeSnapshotsResponse": { - "title": "ExtListVolumeSnapshotsResponse", - "required": [ - "volume_snapshots" - ], - "type": "object", - "properties": { - "count": { - "title": "Count", - "type": "integer", - "default": 0 - }, - "volume_snapshots": { - "title": "Volume Snapshots", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListVolumeSnapshotsBaseResponse" - } - } - } - }, - "ExtListVolumesBaseResponse": { - "title": "ExtListVolumesBaseResponse", - "required": [ - "id", - "origin_data" - ], - "type": "object", - "properties": { - "id": { - "title": "Id", - "type": "string", - "format": "uuid4" - }, - "origin_data": { - "title": "Origin Data", - "type": "object", - "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=list-accessible-volumes-with-details-detail#list-accessible-volumes-with-details" - }, - "project_name": { - "title": "Project Name", - "type": "string" - }, - "attachments": { - "title": "Attachments", - "type": "array", - "items": { - "$ref": "#/components/schemas/VolumeAttachment" - } - }, - "name": { - "title": "Name", - "type": "string", - "description": "Will be removed, please use origin_data[name]", - "deprecated": true - }, - "project_id": { - "title": "Project Id", - "type": "string", - "description": "Will be removed, please use origin_data[os-vol-tenant-attr:tenant_id]", - "deprecated": true - }, - "host": { - "title": "Host", - "type": "string", - "description": "Will be removed, please use origin_data[os-vol-host-attr:host]", - "deprecated": true - }, - "snapshot_id": { - "title": "Snapshot Id", - "type": "string", - "description": "Will be removed, please use origin_data[snapshot_id]", - "deprecated": true - }, - "source_volid": { - "title": "Source Volid", - "type": "string", - "description": "Will be removed, please use origin_data[source_volid]", - "deprecated": true - }, - "size": { - "title": "Size", - "type": "integer", - "description": "Will be removed, please use origin_data[size]", - "deprecated": true - }, - "status": { - "title": "Status", - "type": "string", - "description": "Will be removed, please use origin_data[status]", - "deprecated": true - }, - "volume_type": { - "title": "Volume Type", - "type": "string", - "description": "Will be removed, please use origin_data[volume_type]", - "deprecated": true - }, - "encrypted": { - "title": "Encrypted", - "type": "boolean", - "description": "Will be removed, please use origin_data[encrypted]", - "deprecated": true - }, - "bootable": { - "title": "Bootable", - "type": "string", - "description": "Will be removed, please use origin_data[bootable]", - "deprecated": true - }, - "multiattach": { - "title": "Multiattach", - "type": "boolean", - "description": "Will be removed, please use origin_data[multiattach]", - "deprecated": true - }, - "availability_zone": { - "title": "Availability Zone", - "type": "string", - "description": "Will be removed, please use origin_data[availability_zone]", - "deprecated": true - }, - "created_at": { - "title": "Created At", - "type": "string", - "description": "Will be removed, please use origin_data[created_at]", - "deprecated": true - } - } - }, - "ExtListVolumesResponse": { - "title": "ExtListVolumesResponse", - "required": [ - "volumes" - ], - "type": "object", - "properties": { - "count": { - "title": "Count", - "type": "integer", - "default": 0 - }, - "volumes": { - "title": "Volumes", - "type": "array", - "items": { - "$ref": "#/components/schemas/ExtListVolumesBaseResponse" - } - } - } - }, - "ExtPortDeviceOwner": { - "title": "ExtPortDeviceOwner", - "enum": [ - "", - "compute:nova", - "network:router_ha_interface", - "network:ha_router_replicated_interface", - "network:router_interface", - "network:router_gateway", - "network:floatingip", - "network:local_ip", - "network:dhcp", - "network:router_interface_distributed", - "network:floatingip_agent_gateway", - "network:router_centralized_snat", - "network:routed", - "network:distributed" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtPortSortKey": { - "title": "ExtPortSortKey", - "enum": [ - "id", - "name", - "mac_address", - "status", - "project_id" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtPortStatus": { - "title": "ExtPortStatus", - "enum": [ - "ACTIVE", - "DOWN", - "BUILD", - "ERROR", - "N/A" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtRecycleServerSortKey": { - "title": "ExtRecycleServerSortKey", - "enum": [ - "uuid", - "display_name", - "updated_at", - "project_id" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtServerSortKey": { - "title": "ExtServerSortKey", - "enum": [ - "uuid", - "display_name", - "vm_state", - "locked", - "created_at", - "host", - "project_id" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtServerStatus": { - "title": "ExtServerStatus", - "enum": [ - "ACTIVE", - "BUILD", - "ERROR", - "HARD_REBOOT", - "MIGRATING", - "PAUSED", - "REBOOT", - "REBUILD", - "RESCUE", - "RESIZE", - "SHELVED", - "SHELVED_OFFLOADED", - "SHUTOFF", - "SOFT_DELETED", - "SUSPENDED", - "UNKNOWN" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtSortDir": { - "title": "ExtSortDir", - "enum": [ - "desc", - "asc" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtVolumeSnapshotSortKey": { - "title": "ExtVolumeSnapshotSortKey", - "enum": [ - "id", - "name", - "status", - "created_at" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtVolumeSnapshotStatus": { - "title": "ExtVolumeSnapshotStatus", - "enum": [ - "CREATING", - "AVAILABLE", - "DELETING", - "ERROR", - "ERROR_DELETING" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtVolumeSortKey": { - "title": "ExtVolumeSortKey", - "enum": [ - "id", - "name", - "size", - "status", - "bootable", - "created_at" - ], - "type": "string", - "description": "An enumeration." - }, - "ExtVolumeStatus": { - "title": "ExtVolumeStatus", - "enum": [ - "creating", - "available", - "reserved", - "attaching", - "detaching", - "in-use", - "maintenance", - "deleting", - "awaiting-transfer", - "error", - "error_deleting", - "backing-up", - "restoring-backup", - "error_backing-up", - "error_restoring", - "error_extending", - "downloading", - "uploading", - "retyping", - "extending" - ], - "type": "string", - "description": "An enumeration." - }, "ForbiddenMessage": { "title": "ForbiddenMessage", "required": [ @@ -3008,6 +2230,189 @@ } } }, + "PortDeviceOwner": { + "title": "PortDeviceOwner", + "enum": [ + "", + "compute:nova", + "network:router_ha_interface", + "network:ha_router_replicated_interface", + "network:router_interface", + "network:router_gateway", + "network:floatingip", + "network:local_ip", + "network:dhcp", + "network:router_interface_distributed", + "network:floatingip_agent_gateway", + "network:router_centralized_snat", + "network:routed", + "network:distributed" + ], + "type": "string", + "description": "An enumeration." + }, + "PortSortKey": { + "title": "PortSortKey", + "enum": [ + "id", + "name", + "mac_address", + "status", + "project_id" + ], + "type": "string", + "description": "An enumeration." + }, + "PortStatus": { + "title": "PortStatus", + "enum": [ + "ACTIVE", + "DOWN", + "BUILD", + "ERROR", + "N/A" + ], + "type": "string", + "description": "An enumeration." + }, + "PortsResponse": { + "title": "PortsResponse", + "required": [ + "ports" + ], + "type": "object", + "properties": { + "ports": { + "title": "Ports", + "type": "array", + "items": { + "$ref": "#/components/schemas/PortsResponseBase" + }, + "description": "Ports list" + } + } + }, + "PortsResponseBase": { + "title": "PortsResponseBase", + "required": [ + "id", + "origin_data" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "Port ID" + }, + "origin_data": { + "title": "Origin Data", + "type": "object", + "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#list-ports" + }, + "server_name": { + "title": "Server Name", + "type": "string", + "description": "Server name" + }, + "network_name": { + "title": "Network Name", + "type": "string", + "description": "Network name" + }, + "ipv4": { + "title": "Ipv4", + "type": "array", + "items": {}, + "description": "IPv4 addresses" + }, + "ipv6": { + "title": "Ipv6", + "type": "array", + "items": {}, + "description": "IPv6 addresses" + }, + "name": { + "title": "Name", + "type": "string", + "description": "Will be removed, please use origin_data[name]", + "deprecated": true + }, + "mac_address": { + "title": "Mac Address", + "type": "string", + "description": "Will be removed, please use origin_data[mac_address]", + "deprecated": true + }, + "project_id": { + "title": "Project Id", + "type": "string", + "description": "Will be removed, please use origin_data[project_id]", + "deprecated": true + }, + "device_owner": { + "title": "Device Owner", + "type": "string", + "description": "Will be removed, please use origin_data[device_owner]", + "deprecated": true + }, + "device_id": { + "title": "Device Id", + "type": "string", + "description": "Will be removed, please use origin_data[device_id]", + "deprecated": true + }, + "status": { + "title": "Status", + "type": "string", + "description": "Will be removed, please use origin_data[status]", + "deprecated": true + }, + "created_at": { + "title": "Created At", + "type": "string", + "description": "Will be removed, please use origin_data[created_at]", + "deprecated": true + }, + "network_id": { + "title": "Network Id", + "type": "string", + "description": "Will be removed, please use origin_data[network_id]", + "deprecated": true + }, + "binding_vnic_type": { + "title": "Binding Vnic Type", + "type": "string", + "description": "Will be removed, please use origin_data[binding:vnic_type]", + "deprecated": true + }, + "description": { + "title": "Description", + "type": "string", + "description": "Will be removed, please use origin_data[description]", + "deprecated": true + }, + "port_security_enabled": { + "title": "Port Security Enabled", + "type": "boolean", + "description": "Will be removed, please use origin_data[port_security_enabled]", + "deprecated": true + }, + "qos_policy_id": { + "title": "Qos Policy Id", + "type": "string", + "description": "Will be removed, please use origin_data[qos_policy_id]", + "deprecated": true + }, + "fixed_ips": { + "title": "Fixed Ips", + "type": "array", + "items": {}, + "description": "Will be removed, please use origin_data[fixed_ips]", + "deprecated": true + } + } + }, "Profile": { "title": "Profile", "required": [ @@ -3307,6 +2712,145 @@ } } }, + "RecycleServerSortKey": { + "title": "RecycleServerSortKey", + "enum": [ + "uuid", + "display_name", + "updated_at", + "project_id" + ], + "type": "string", + "description": "An enumeration." + }, + "RecycleServersResponse": { + "title": "RecycleServersResponse", + "required": [ + "recycle_servers" + ], + "type": "object", + "properties": { + "recycle_servers": { + "title": "Recycle Servers", + "type": "array", + "items": { + "$ref": "#/components/schemas/RecycleServersResponseBase" + }, + "description": "Recycle servers list" + } + } + }, + "RecycleServersResponseBase": { + "title": "RecycleServersResponseBase", + "required": [ + "id", + "origin_data", + "reclaim_timestamp" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "Recycle server id", + "format": "uuid4" + }, + "origin_data": { + "title": "Origin Data", + "type": "object", + "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#list-servers-detailed" + }, + "project_name": { + "title": "Project Name", + "type": "string", + "description": "Project name" + }, + "image": { + "title": "Image", + "type": "string", + "description": "Image id", + "format": "uuid4" + }, + "image_name": { + "title": "Image Name", + "type": "string", + "description": "Image name" + }, + "image_os_distro": { + "title": "Image Os Distro", + "type": "string", + "description": "Image os distro" + }, + "fixed_addresses": { + "title": "Fixed Addresses", + "type": "array", + "items": {}, + "description": "Fixed addresses" + }, + "floating_addresses": { + "title": "Floating Addresses", + "type": "array", + "items": {}, + "description": "Floating addresses" + }, + "deleted_at": { + "title": "Deleted At", + "type": "string", + "description": "Deleted at" + }, + "reclaim_timestamp": { + "title": "Reclaim Timestamp", + "type": "number", + "description": "Reclaim timestamp" + }, + "name": { + "title": "Name", + "type": "string", + "description": "Will be removed, please use origin_data[name]", + "deprecated": true + }, + "project_id": { + "title": "Project Id", + "type": "string", + "description": "Will be removed, please use origin_data[tenant_id]", + "deprecated": true + }, + "host": { + "title": "Host", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:host]", + "deprecated": true + }, + "hostname": { + "title": "Hostname", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:hostname]", + "deprecated": true + }, + "flavor": { + "title": "Flavor", + "type": "string", + "description": "Will be removed, please use origin_data[flavor][original_name]", + "deprecated": true + }, + "flavor_info": { + "title": "Flavor Info", + "allOf": [ + { + "$ref": "#/components/schemas/FlavorInServer" + } + ], + "description": "Will be removed, please use origin_data[flavor]", + "deprecated": true + }, + "status": { + "title": "Status", + "type": "string", + "description": "Will be removed, please use origin_data[status]", + "deprecated": true + } + } + }, "Role": { "title": "Role", "required": [ @@ -3327,6 +2871,201 @@ } } }, + "ServerSortKey": { + "title": "ServerSortKey", + "enum": [ + "uuid", + "display_name", + "vm_state", + "locked", + "created_at", + "host", + "project_id" + ], + "type": "string", + "description": "An enumeration." + }, + "ServerStatus": { + "title": "ServerStatus", + "enum": [ + "ACTIVE", + "BUILD", + "ERROR", + "HARD_REBOOT", + "MIGRATING", + "PAUSED", + "REBOOT", + "REBUILD", + "RESCUE", + "RESIZE", + "SHELVED", + "SHELVED_OFFLOADED", + "SHUTOFF", + "SOFT_DELETED", + "SUSPENDED", + "UNKNOWN" + ], + "type": "string", + "description": "An enumeration." + }, + "ServersResponse": { + "title": "ServersResponse", + "required": [ + "servers" + ], + "type": "object", + "properties": { + "servers": { + "title": "Servers", + "type": "array", + "items": { + "$ref": "#/components/schemas/ServersResponseBase" + }, + "description": "Servers list" + } + } + }, + "ServersResponseBase": { + "title": "ServersResponseBase", + "required": [ + "Server ID", + "origin_data" + ], + "type": "object", + "properties": { + "Server ID": { + "title": "Server Id", + "type": "string", + "format": "uuid4" + }, + "origin_data": { + "title": "Origin Data", + "type": "object", + "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/compute/?expanded=list-servers-detailed-detail#list-servers-detailed" + }, + "project_name": { + "title": "Project Name", + "type": "string", + "description": "Project name" + }, + "image": { + "title": "Image", + "type": "string", + "description": "Image ID", + "format": "uuid4" + }, + "image_name": { + "title": "Image Name", + "type": "string", + "description": "Image name" + }, + "image_os_distro": { + "title": "Image Os Distro", + "type": "string", + "description": "Image OS distro" + }, + "fixed_addresses": { + "title": "Fixed Addresses", + "type": "array", + "items": {}, + "description": "Fixed addresses" + }, + "floating_addresses": { + "title": "Floating Addresses", + "type": "array", + "items": {}, + "description": "Floating addresses" + }, + "name": { + "title": "Name", + "type": "string", + "description": "Will be removed, please use origin_data[name]", + "deprecated": true + }, + "project_id": { + "title": "Project Id", + "type": "string", + "description": "Will be removed, please use origin_data[tenant_id]", + "deprecated": true + }, + "host": { + "title": "Host", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:host]", + "deprecated": true + }, + "hostname": { + "title": "Hostname", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:hostname]", + "deprecated": true + }, + "flavor": { + "title": "Flavor", + "type": "string", + "description": "Will be removed, please use origin_data[flavor][original_name]", + "deprecated": true + }, + "flavor_info": { + "title": "Flavor Info", + "allOf": [ + { + "$ref": "#/components/schemas/FlavorInServer" + } + ], + "description": "Will be removed, please use origin_data[flavor]", + "deprecated": true + }, + "status": { + "title": "Status", + "type": "string", + "description": "Will be removed, please use origin_data[status]", + "deprecated": true + }, + "locked": { + "title": "Locked", + "type": "boolean", + "description": "Will be removed, please use origin_data[locked]", + "deprecated": true + }, + "created_at": { + "title": "Created At", + "type": "string", + "description": "Will be removed, please use origin_data[created]", + "deprecated": true + }, + "task_state": { + "title": "Task State", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-STS:task_state]", + "deprecated": true + }, + "vm_state": { + "title": "Vm State", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-STS:vm_state]", + "deprecated": true + }, + "power_state": { + "title": "Power State", + "type": "integer", + "description": "Will be removed, please use origin_data[OS-EXT-STS:power_state]", + "deprecated": true + }, + "root_device_name": { + "title": "Root Device Name", + "type": "string", + "description": "Will be removed, please use origin_data[OS-EXT-SRV-ATTR:root_device_name]", + "deprecated": true + }, + "metadata": { + "title": "Metadata", + "type": "object", + "description": "Will be removed, please use origin_data[metadata]", + "deprecated": true + } + } + }, "Setting": { "title": "Setting", "required": [ @@ -3374,6 +3113,15 @@ } } }, + "SortDir": { + "title": "SortDir", + "enum": [ + "desc", + "asc" + ], + "type": "string", + "description": "An enumeration." + }, "UnauthorizedMessage": { "title": "UnauthorizedMessage", "required": [ @@ -3472,19 +3220,327 @@ "properties": { "id": { "title": "Id", - "type": "string" + "type": "string", + "description": "Volume attachment id" }, "device": { "title": "Device", - "type": "string" + "type": "string", + "description": "Device name" }, "server_id": { "title": "Server Id", - "type": "string" + "type": "string", + "description": "Server id" }, "server_name": { "title": "Server Name", - "type": "string" + "type": "string", + "description": "Server name" + } + } + }, + "VolumeSnapshotSortKey": { + "title": "VolumeSnapshotSortKey", + "enum": [ + "id", + "name", + "status", + "created_at" + ], + "type": "string", + "description": "An enumeration." + }, + "VolumeSnapshotStatus": { + "title": "VolumeSnapshotStatus", + "enum": [ + "CREATING", + "AVAILABLE", + "DELETING", + "ERROR", + "ERROR_DELETING" + ], + "type": "string", + "description": "An enumeration." + }, + "VolumeSnapshotsResponse": { + "title": "VolumeSnapshotsResponse", + "required": [ + "volume_snapshots" + ], + "type": "object", + "properties": { + "count": { + "title": "Count", + "type": "integer", + "description": "Count of volume snapshots", + "default": 0 + }, + "volume_snapshots": { + "title": "Volume Snapshots", + "type": "array", + "items": { + "$ref": "#/components/schemas/VolumeSnapshotsResponseBase" + }, + "description": "Volume snapshots list" + } + } + }, + "VolumeSnapshotsResponseBase": { + "title": "VolumeSnapshotsResponseBase", + "required": [ + "id", + "origin_data" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "Snapshot ID" + }, + "origin_data": { + "title": "Origin Data", + "type": "object", + "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=list-snapshots-and-details-detail#list-snapshots-and-details" + }, + "project_name": { + "title": "Project Name", + "type": "string", + "description": "Project name" + }, + "host": { + "title": "Host", + "type": "string", + "description": "Host name" + }, + "volume_name": { + "title": "Volume Name", + "type": "string", + "description": "Volume name" + }, + "child_volumes": { + "title": "Child Volumes", + "type": "array", + "items": {}, + "description": "Child volumes" + }, + "name": { + "title": "Name", + "type": "string", + "description": "Will be removed, please use origin_data[name]", + "deprecated": true + }, + "project_id": { + "title": "Project Id", + "type": "string", + "description": "Will be removed, please use origin_data[os-extended-snapshot-attributes:project_id]", + "deprecated": true + }, + "size": { + "title": "Size", + "type": "integer", + "description": "Will be removed, please use origin_data[size]", + "deprecated": true + }, + "status": { + "title": "Status", + "type": "string", + "description": "Will be removed, please use origin_data[status]", + "deprecated": true + }, + "volume_id": { + "title": "Volume Id", + "type": "string", + "description": "Will be removed, please use origin_data[volume_id]", + "deprecated": true + }, + "created_at": { + "title": "Created At", + "type": "string", + "description": "Will be removed, please use origin_data[created_at]", + "deprecated": true + }, + "metadata": { + "title": "Metadata", + "type": "object", + "description": "Will be removed, please use origin_data[metadata]", + "deprecated": true + } + } + }, + "VolumeSortKey": { + "title": "VolumeSortKey", + "enum": [ + "id", + "name", + "size", + "status", + "bootable", + "created_at" + ], + "type": "string", + "description": "An enumeration." + }, + "VolumeStatus": { + "title": "VolumeStatus", + "enum": [ + "creating", + "available", + "reserved", + "attaching", + "detaching", + "in-use", + "maintenance", + "deleting", + "awaiting-transfer", + "error", + "error_deleting", + "backing-up", + "restoring-backup", + "error_backing-up", + "error_restoring", + "error_extending", + "downloading", + "uploading", + "retyping", + "extending" + ], + "type": "string", + "description": "An enumeration." + }, + "VolumesResponse": { + "title": "VolumesResponse", + "required": [ + "volumes" + ], + "type": "object", + "properties": { + "count": { + "title": "Count", + "type": "integer", + "description": "Count of volumes", + "default": 0 + }, + "volumes": { + "title": "Volumes", + "type": "array", + "items": { + "$ref": "#/components/schemas/VolumesResponseBase" + }, + "description": "Volumes list" + } + } + }, + "VolumesResponseBase": { + "title": "VolumesResponseBase", + "required": [ + "id", + "origin_data" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "Volume ID", + "format": "uuid4" + }, + "origin_data": { + "title": "Origin Data", + "type": "object", + "description": "The origin_data is the same like the response of https://docs.openstack.org/api-ref/block-storage/v3/index.html?expanded=list-accessible-volumes-with-details-detail#list-accessible-volumes-with-details" + }, + "project_name": { + "title": "Project Name", + "type": "string", + "description": "Project name" + }, + "attachments": { + "title": "Attachments", + "type": "array", + "items": { + "$ref": "#/components/schemas/VolumeAttachment" + }, + "description": "Volume attachments" + }, + "name": { + "title": "Name", + "type": "string", + "description": "Will be removed, please use origin_data[name]", + "deprecated": true + }, + "project_id": { + "title": "Project Id", + "type": "string", + "description": "Will be removed, please use origin_data[os-vol-tenant-attr:tenant_id]", + "deprecated": true + }, + "host": { + "title": "Host", + "type": "string", + "description": "Will be removed, please use origin_data[os-vol-host-attr:host]", + "deprecated": true + }, + "snapshot_id": { + "title": "Snapshot Id", + "type": "string", + "description": "Will be removed, please use origin_data[snapshot_id]", + "deprecated": true + }, + "source_volid": { + "title": "Source Volid", + "type": "string", + "description": "Will be removed, please use origin_data[source_volid]", + "deprecated": true + }, + "size": { + "title": "Size", + "type": "integer", + "description": "Will be removed, please use origin_data[size]", + "deprecated": true + }, + "status": { + "title": "Status", + "type": "string", + "description": "Will be removed, please use origin_data[status]", + "deprecated": true + }, + "volume_type": { + "title": "Volume Type", + "type": "string", + "description": "Will be removed, please use origin_data[volume_type]", + "deprecated": true + }, + "encrypted": { + "title": "Encrypted", + "type": "boolean", + "description": "Will be removed, please use origin_data[encrypted]", + "deprecated": true + }, + "bootable": { + "title": "Bootable", + "type": "string", + "description": "Will be removed, please use origin_data[bootable]", + "deprecated": true + }, + "multiattach": { + "title": "Multiattach", + "type": "boolean", + "description": "Will be removed, please use origin_data[multiattach]", + "deprecated": true + }, + "availability_zone": { + "title": "Availability Zone", + "type": "string", + "description": "Will be removed, please use origin_data[availability_zone]", + "deprecated": true + }, + "created_at": { + "title": "Created At", + "type": "string", + "description": "Will be removed, please use origin_data[created_at]", + "deprecated": true } } } diff --git a/skyline_apiserver/api/v1/extension.py b/skyline_apiserver/api/v1/extension.py index 935002e..a7d8045 100644 --- a/skyline_apiserver/api/v1/extension.py +++ b/skyline_apiserver/api/v1/extension.py @@ -49,13 +49,13 @@ List Servers. - The `name` is to support for fuzzy queries. """, responses={ - 200: {"model": schemas.ExtListServersResponse}, + 200: {"model": schemas.ServersResponse}, 400: {"model": schemas.BadRequestMessage}, 401: {"model": schemas.UnauthorizedMessage}, 403: {"model": schemas.ForbiddenMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListServersResponse, + response_model=schemas.ServersResponse, status_code=status.HTTP_200_OK, response_description="OK", ) @@ -68,8 +68,8 @@ async def list_servers( ), limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT), marker: str = None, - sort_dirs: schemas.ExtSortDir = None, - sort_keys: List[schemas.ExtServerSortKey] = Query(None), + sort_dirs: schemas.SortDir = None, + sort_keys: List[schemas.ServerSortKey] = Query(None), all_projects: bool = None, project_id: str = Query( None, @@ -80,11 +80,11 @@ async def list_servers( description="Only works when the all_projects filter is also specified.", ), name: str = None, - status: schemas.ExtServerStatus = None, + status: schemas.ServerStatus = None, host: str = Query(None, description="It will be ignored for non-admin user."), flavor_id: str = None, uuid: str = Query(None, description="UUID of server."), -) -> schemas.ExtListServersResponse: +) -> schemas.ServersResponse: """Extension List Servers. :param profile: Profile object include token, role and so on, @@ -96,9 +96,9 @@ async def list_servers( :param marker: Marker object to fetch, defaults to None :type marker: str, optional :param sort_dirs: Sort order, defaults to None - :type sort_dirs: schemas.ExtSortDir, optional + :type sort_dirs: schemas.SortDir, optional :param sort_keys: Sort keys, defaults to Query(None) - :type sort_keys: List[schemas.ExtServerSortKey], optional + :type sort_keys: List[schemas.ServerSortKey], optional :param all_projects: All projects to fetch, defaults to None :type all_projects: bool, optional :param project_id: Filter by id of project which server belongs to, @@ -112,7 +112,7 @@ async def list_servers( :param name: Filter by server name, defaults to None :type name: str, optional :param status: Filter by server status, defaults to None - :type status: schemas.ExtServerStatus, optional + :type status: schemas.ServerStatus, optional :param host: Filter by host which server is located at, defaults to Query(None, description="It will be ignored for non-admin user.") :type host: str, optional @@ -122,7 +122,7 @@ async def list_servers( :type uuid: str, optional :raises HTTPException: HTTP Exception :return: Server List - :rtype: schemas.ExtListServersResponse + :rtype: schemas.ServersResponse """ if all_projects: assert_system_admin_or_reader( @@ -280,13 +280,13 @@ List Recycle Servers. - The `name` is to support for fuzzy queries. """, responses={ - 200: {"model": schemas.ExtListRecycleServersResponse}, + 200: {"model": schemas.RecycleServersResponse}, 400: {"model": schemas.BadRequestMessage}, 401: {"model": schemas.UnauthorizedMessage}, 403: {"model": schemas.ForbiddenMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListRecycleServersResponse, + response_model=schemas.RecycleServersResponse, status_code=status.HTTP_200_OK, response_description="OK", ) @@ -299,8 +299,8 @@ async def list_recycle_servers( ), limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT), marker: str = None, - sort_dirs: schemas.ExtSortDir = None, - sort_keys: List[schemas.ExtRecycleServerSortKey] = Query(None), + sort_dirs: schemas.SortDir = None, + sort_keys: List[schemas.RecycleServerSortKey] = Query(None), all_projects: bool = None, project_id: str = Query( None, @@ -312,7 +312,7 @@ async def list_recycle_servers( ), name: str = None, uuid: str = Query(None, description="UUID of recycle server."), -) -> schemas.ExtListRecycleServersResponse: +) -> schemas.RecycleServersResponse: """Extension List Recycle Servers. :param profile: Profile object include token, role and so on, @@ -324,9 +324,9 @@ async def list_recycle_servers( :param marker: Marker object to fetch, defaults to None :type marker: str, optional :param sort_dirs: Sort order, defaults to None - :type sort_dirs: schemas.ExtSortDir, optional + :type sort_dirs: schemas.SortDir, optional :param sort_keys: Sort keys, defaults to Query(None) - :type sort_keys: List[schemas.ExtServerSortKey], optional + :type sort_keys: List[schemas.RecycleServerSortKey], optional :param all_projects: All projects to fetch, defaults to None :type all_projects: bool, optional :param project_id: Filter by id of project which recycle server belongs to, @@ -344,7 +344,7 @@ async def list_recycle_servers( :type uuid: str, optional :raises HTTPException: HTTP Exception :return: Recycle server list - :rtype: schemas.ExtListRecycleServersResponse + :rtype: schemas.RecycleServersResponse """ if all_projects: @@ -503,12 +503,12 @@ async def list_recycle_servers( "/extension/volumes", description="List Volumes.", responses={ - 200: {"model": schemas.ExtListVolumesResponse}, + 200: {"model": schemas.VolumesResponse}, 401: {"model": schemas.UnauthorizedMessage}, 403: {"model": schemas.ForbiddenMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListVolumesResponse, + response_model=schemas.VolumesResponse, status_code=status.HTTP_200_OK, response_description="OK", ) @@ -521,16 +521,16 @@ async def list_volumes( ), limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT), marker: str = None, - sort_dirs: schemas.ExtSortDir = None, - sort_keys: List[schemas.ExtVolumeSortKey] = Query(None), + sort_dirs: schemas.SortDir = None, + sort_keys: List[schemas.VolumeSortKey] = Query(None), all_projects: bool = None, project_id: str = None, name: str = None, multiattach: bool = None, - status: schemas.ExtVolumeStatus = None, + status: schemas.VolumeStatus = None, bootable: bool = None, uuid: List[str] = Query(None, description="UUID of volume."), -) -> schemas.ExtListVolumesResponse: +) -> schemas.VolumesResponse: """Extension List Volumes. :param profile: Profile object include token, role and so on, @@ -542,9 +542,9 @@ async def list_volumes( :param marker: Marker object to fetch, defaults to None :type marker: str, optional :param sort_dirs: Sort order, defaults to None - :type sort_dirs: schemas.ExtSortDir, optional + :type sort_dirs: schemas.SortDir, optional :param sort_keys: Sort keys, defaults to Query(None) - :type sort_keys: List[schemas.ExtServerSortKey], optional + :type sort_keys: List[schemas.VolumeSortKey], optional :param all_projects: All projects to fetch, defaults to None :type all_projects: bool, optional :param project_id: Filter by id of project which volume belongs to, @@ -556,14 +556,14 @@ async def list_volumes( defaults to None :type multiattach: bool, optional :param status: Filter by volume status, defaults to None - :type status: schemas.ExtVolumeStatus, optional + :type status: schemas.VolumeStatus, optional :type bootable: Filter by bootable that server be used to create an instance quickly. :type bootable: bool, optional :param uuid: Filter by list uuid, defaults to Query(None, description="UUID of volume.") :type uuid: List[str], optional :return: Volume list - :rtype: schemas.ExtListVolumesResponse + :rtype: schemas.VolumesResponse """ if all_projects: assert_system_admin_or_reader( @@ -699,12 +699,12 @@ async def list_volumes( "/extension/volume_snapshots", description="List Volume Snapshots.", responses={ - 200: {"model": schemas.ExtListVolumeSnapshotsResponse}, + 200: {"model": schemas.VolumeSnapshotsResponse}, 401: {"model": schemas.UnauthorizedMessage}, 403: {"model": schemas.ForbiddenMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListVolumeSnapshotsResponse, + response_model=schemas.VolumeSnapshotsResponse, status_code=status.HTTP_200_OK, response_description="OK", ) @@ -717,14 +717,14 @@ async def list_volume_snapshots( ), limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT), marker: str = None, - sort_dirs: schemas.ExtSortDir = None, - sort_keys: List[schemas.ExtVolumeSnapshotSortKey] = Query(None), + sort_dirs: schemas.SortDir = None, + sort_keys: List[schemas.VolumeSnapshotSortKey] = Query(None), all_projects: bool = None, project_id: str = None, name: str = None, - status: schemas.ExtVolumeSnapshotStatus = None, + status: schemas.VolumeSnapshotStatus = None, volume_id: str = None, -) -> schemas.ExtListVolumeSnapshotsResponse: +) -> schemas.VolumeSnapshotsResponse: """Extension List Volume Snapshots. :param profile: Profile object include token, role and so on, @@ -736,9 +736,9 @@ async def list_volume_snapshots( :param marker: Marker object to fetch, defaults to None :type marker: str, optional :param sort_dirs: Sort order, defaults to None - :type sort_dirs: schemas.ExtSortDir, optional + :type sort_dirs: schemas.SortDir, optional :param sort_keys: Sort keys, defaults to Query(None) - :type sort_keys: List[schemas.ExtServerSortKey], optional + :type sort_keys: List[schemas.VolumeSnapshotSortKey], optional :param all_projects: All projects to fetch, defaults to None :type all_projects: bool, optional :param project_id: Filter by id of project which volume snapshots belongs to, @@ -747,11 +747,11 @@ async def list_volume_snapshots( :param name: Filter by volume snapshot name, defaults to None :type name: str, optional :param status: Filter by volume snapshot status, defaults to None - :type status: schemas.ExtVolumeSnapshotStatus, optional + :type status: schemas.VolumeSnapshotStatus, optional :param volume_id: Filter by volume id, defaults to None :type volume_id: str, optional :return: Volume snapshot list - :rtype: schemas.ExtListVolumeSnapshotsResponse + :rtype: schemas.VolumeSnapshotsResponse """ if all_projects: assert_system_admin_or_reader( @@ -877,7 +877,7 @@ async def list_volume_snapshots( 403: {"model": schemas.ForbiddenMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListPortsResponse, + response_model=schemas.PortsResponse, status_code=status.HTTP_200_OK, response_description="OK", ) @@ -890,18 +890,18 @@ async def list_ports( ), limit: int = Query(None, gt=constants.EXTENSION_API_LIMIT_GT), marker: str = None, - sort_dirs: schemas.ExtSortDir = None, - sort_keys: List[schemas.ExtPortSortKey] = Query(None), + sort_dirs: schemas.SortDir = None, + sort_keys: List[schemas.PortSortKey] = Query(None), all_projects: bool = None, project_id: str = None, name: str = None, - status: schemas.ExtPortStatus = None, + status: schemas.PortStatus = None, network_name: str = None, network_id: str = None, device_id: str = None, - device_owner: List[schemas.ExtPortDeviceOwner] = Query(None), + device_owner: List[schemas.PortDeviceOwner] = Query(None), uuid: List[str] = Query(None, description="UUID of port."), -) -> schemas.ExtListPortsResponse: +) -> schemas.PortsResponse: """Extension List Ports. :param profile: Profile object include token, role and so on, @@ -913,7 +913,7 @@ async def list_ports( :param marker: Marker object to fetch, defaults to None :type marker: str, optional :param sort_dirs: Sort order, defaults to None - :type sort_dirs: schemas.ExtSortDir, optional + :type sort_dirs: schemas.SortDir, optional :param sort_keys: Sort keys, defaults to Query(None) :type sort_keys: List[schemas.ExtServerSortKey], optional :param all_projects: All projects to fetch, defaults to None @@ -924,7 +924,7 @@ async def list_ports( :param name: Filter by port name, defaults to None :type name: str, optional :param status: Filter by port status, defaults to None - :type status: schemas.ExtPortStatus, optional + :type status: schemas.PortStatus, optional :param network_name: Filter by name of network, defaults to None :type network_name: str, optional :param network_id: Filter by id of network, defaults to None @@ -932,12 +932,12 @@ async def list_ports( :param device_id: Filter by id of device, defaults to None :type device_id: str, optional :param device_owner: Filter by device owner, defaults to Query(None) - :type device_owner: List[schemas.ExtPortDeviceOwner], optional + :type device_owner: List[schemas.PortDeviceOwner], optional :param uuid: Filter by list uuid, defaults to Query(None, description="UUID of port.") :type uuid: List[str], optional :return: Port list - :rtype: schemas.ExtListPortsResponse + :rtype: schemas.PortsResponse """ current_session = await generate_session(profile=profile) @@ -1062,11 +1062,11 @@ async def list_ports( "/extension/compute-services", description="List compute services.", responses={ - 200: {"model": schemas.ExtListComputeServicesResponse}, + 200: {"model": schemas.ComputeServicesResponse}, 401: {"model": schemas.UnauthorizedMessage}, 500: {"model": schemas.InternalServerErrorMessage}, }, - response_model=schemas.ExtListComputeServicesResponse, + response_model=schemas.ComputeServicesResponse, status_code=status.HTTP_200_OK, response_description="OK", response_model_exclude_none=True, @@ -1080,7 +1080,7 @@ async def compute_services( ), binary: str = None, host: str = None, -) -> schemas.ExtListComputeServicesResponse: +) -> schemas.ComputeServicesResponse: """Extension List Compute Services. :param profile: Profile object include token, role and so on, @@ -1091,7 +1091,7 @@ async def compute_services( :param host: Filter by host name, defaults to None :type host: str, optional :return: Compute service list - :rtype: schemas.ExtListComputeServicesResponse + :rtype: schemas.ComputeServicesResponse """ assert_system_admin_or_reader( profile=profile, diff --git a/skyline_apiserver/schemas/__init__.py b/skyline_apiserver/schemas/__init__.py index 8cc9d6b..ae0bde5 100644 --- a/skyline_apiserver/schemas/__init__.py +++ b/skyline_apiserver/schemas/__init__.py @@ -24,23 +24,23 @@ from .common import ( ) from .contrib import KeystoneEndpoints from .extension import ( - ExtListComputeServicesResponse, - ExtListPortsResponse, - ExtListRecycleServersResponse, - ExtListServersResponse, - ExtListVolumeSnapshotsResponse, - ExtListVolumesResponse, - ExtPortDeviceOwner, - ExtPortSortKey, - ExtPortStatus, - ExtRecycleServerSortKey, - ExtServerSortKey, - ExtServerStatus, - ExtSortDir, - ExtVolumeSnapshotSortKey, - ExtVolumeSnapshotStatus, - ExtVolumeSortKey, - ExtVolumeStatus, + ComputeServicesResponse, + PortDeviceOwner, + PortSortKey, + PortsResponse, + PortStatus, + RecycleServerSortKey, + RecycleServersResponse, + ServerSortKey, + ServersResponse, + ServerStatus, + SortDir, + VolumeSnapshotSortKey, + VolumeSnapshotsResponse, + VolumeSnapshotStatus, + VolumeSortKey, + VolumesResponse, + VolumeStatus, ) from .login import Credential, Payload, Profile from .policy import Policies, PoliciesRules diff --git a/skyline_apiserver/schemas/extension.py b/skyline_apiserver/schemas/extension.py index 853e019..e47c4e9 100644 --- a/skyline_apiserver/schemas/extension.py +++ b/skyline_apiserver/schemas/extension.py @@ -26,7 +26,7 @@ VOLUME_SNAPSHOTS_LIST_DOCS_LINKS = "https://docs.openstack.org/api-ref/block-sto PORTS_LIST_DOCS_LINKS = "https://docs.openstack.org/api-ref/network/v2/index.html?expanded=list-ports-detail#list-ports" # noqa -class ExtServerStatus(str, Enum): +class ServerStatus(str, Enum): ACTIVE = "ACTIVE" BUILD = "BUILD" # DELETED = "DELETED" @@ -52,7 +52,7 @@ class ExtServerStatus(str, Enum): return self.value -class ExtVolumeStatus(str, Enum): +class VolumeStatus(str, Enum): creating = "creating" available = "available" reserved = "reserved" @@ -78,7 +78,7 @@ class ExtVolumeStatus(str, Enum): return self.value -class ExtVolumeSnapshotStatus(str, Enum): +class VolumeSnapshotStatus(str, Enum): CREATING = "CREATING" AVAILABLE = "AVAILABLE" # BACKING_UP = "BACKING_UP" @@ -93,7 +93,7 @@ class ExtVolumeSnapshotStatus(str, Enum): return self.value -class ExtPortStatus(str, Enum): +class PortStatus(str, Enum): ACTIVE = "ACTIVE" DOWN = "DOWN" BUILD = "BUILD" @@ -104,7 +104,7 @@ class ExtPortStatus(str, Enum): return self.value -class ExtPortDeviceOwner(str, Enum): +class PortDeviceOwner(str, Enum): null = "" # prefix compute compute_nova = "compute:nova" @@ -126,7 +126,7 @@ class ExtPortDeviceOwner(str, Enum): return self.value -class ExtSortDir(str, Enum): +class SortDir(str, Enum): desc = "desc" asc = "asc" @@ -134,7 +134,7 @@ class ExtSortDir(str, Enum): return self.value -class ExtServerSortKey(str, Enum): +class ServerSortKey(str, Enum): uuid = "uuid" display_name = "display_name" vm_state = "vm_state" @@ -147,7 +147,7 @@ class ExtServerSortKey(str, Enum): return self.value -class ExtRecycleServerSortKey(str, Enum): +class RecycleServerSortKey(str, Enum): uuid = "uuid" display_name = "display_name" updated_at = "updated_at" @@ -157,7 +157,7 @@ class ExtRecycleServerSortKey(str, Enum): return self.value -class ExtVolumeSortKey(str, Enum): +class VolumeSortKey(str, Enum): id = "id" name = "name" size = "size" @@ -169,7 +169,7 @@ class ExtVolumeSortKey(str, Enum): return self.value -class ExtVolumeSnapshotSortKey(str, Enum): +class VolumeSnapshotSortKey(str, Enum): id = "id" name = "name" status = "status" @@ -179,7 +179,7 @@ class ExtVolumeSnapshotSortKey(str, Enum): return self.value -class ExtPortSortKey(str, Enum): +class PortSortKey(str, Enum): id = "id" name = "name" mac_address = "mac_address" @@ -190,27 +190,27 @@ class ExtPortSortKey(str, Enum): return self.value -class ExtFlavor(BaseModel): - ephemeral: Optional[int] - ram: Optional[int] - original_name: Optional[str] - vcpus: Optional[int] - extra_specs: Optional[Dict[str, Any]] - swap: Optional[int] - disk: Optional[int] +class FlavorInServer(BaseModel): + ephemeral: Optional[int] = Field(None, description="Ephemeral disk size in GB") + ram: Optional[int] = Field(None, description="RAM size in MB") + original_name: Optional[str] = Field(None, description="Original flavor name") + vcpus: Optional[int] = Field(None, description="Number of vCPUs") + extra_specs: Optional[Dict[str, Any]] = Field(None, description="Extra specs") + swap: Optional[int] = Field(None, description="Swap size in MB") + disk: Optional[int] = Field(None, description="Disk size in GB") -class ExtListServersBaseResponse(BaseModel): - id: UUID4 +class ServersResponseBase(BaseModel): + id: UUID4 = Field(..., alias="Server ID") origin_data: Dict[str, Any] = Field( description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}", ) - project_name: Optional[str] - image: Optional[UUID4] - image_name: Optional[str] - image_os_distro: Optional[str] - fixed_addresses: Optional[List] - floating_addresses: Optional[List] + project_name: Optional[str] = Field(None, description="Project name") + image: Optional[UUID4] = Field(None, description="Image ID") + image_name: Optional[str] = Field(None, description="Image name") + image_os_distro: Optional[str] = Field(None, description="Image OS distro") + fixed_addresses: Optional[List] = Field(None, description="Fixed addresses") + floating_addresses: Optional[List] = Field(None, description="Floating addresses") name: Optional[str] = Field( description="Will be removed, please use origin_data[name]", @@ -232,7 +232,7 @@ class ExtListServersBaseResponse(BaseModel): description="Will be removed, please use origin_data[flavor][original_name]", deprecated=True, ) - flavor_info: Optional[ExtFlavor] = Field( + flavor_info: Optional[FlavorInServer] = Field( description="Will be removed, please use origin_data[flavor]", deprecated=True, ) @@ -270,23 +270,23 @@ class ExtListServersBaseResponse(BaseModel): ) -class ExtListServersResponse(BaseModel): - servers: List[ExtListServersBaseResponse] +class ServersResponse(BaseModel): + servers: List[ServersResponseBase] = Field(..., description="Servers list") -class ExtListRecycleServersBaseResponse(BaseModel): - id: UUID4 +class RecycleServersResponseBase(BaseModel): + id: UUID4 = Field(..., description="Recycle server id") origin_data: Dict[str, Any] = Field( description=f"The origin_data is the same like the response of {SERVERS_LIST_DOCS_LINKS}", ) - project_name: Optional[str] - image: Optional[UUID4] - image_name: Optional[str] - image_os_distro: Optional[str] - fixed_addresses: Optional[List] - floating_addresses: Optional[List] - deleted_at: Optional[str] - reclaim_timestamp: float + project_name: Optional[str] = Field(None, description="Project name") + image: Optional[UUID4] = Field(None, description="Image id") + image_name: Optional[str] = Field(None, description="Image name") + image_os_distro: Optional[str] = Field(None, description="Image os distro") + fixed_addresses: Optional[List] = Field(None, description="Fixed addresses") + floating_addresses: Optional[List] = Field(None, description="Floating addresses") + deleted_at: Optional[str] = Field(None, description="Deleted at") + reclaim_timestamp: float = Field(..., description="Reclaim timestamp") name: Optional[str] = Field( description="Will be removed, please use origin_data[name]", @@ -308,7 +308,7 @@ class ExtListRecycleServersBaseResponse(BaseModel): description="Will be removed, please use origin_data[flavor][original_name]", deprecated=True, ) - flavor_info: Optional[ExtFlavor] = Field( + flavor_info: Optional[FlavorInServer] = Field( description="Will be removed, please use origin_data[flavor]", deprecated=True, ) @@ -318,24 +318,26 @@ class ExtListRecycleServersBaseResponse(BaseModel): ) -class ExtListRecycleServersResponse(BaseModel): - recycle_servers: List[ExtListRecycleServersBaseResponse] +class RecycleServersResponse(BaseModel): + recycle_servers: List[RecycleServersResponseBase] = Field( + ..., description="Recycle servers list" + ) class VolumeAttachment(BaseModel): - id: str - device: Optional[str] - server_id: Optional[str] - server_name: Optional[str] + id: str = Field(..., description="Volume attachment id") + device: Optional[str] = Field(None, description="Device name") + server_id: Optional[str] = Field(None, description="Server id") + server_name: Optional[str] = Field(None, description="Server name") -class ExtListVolumesBaseResponse(BaseModel): - id: UUID4 +class VolumesResponseBase(BaseModel): + id: UUID4 = Field(..., description="Volume ID") origin_data: Dict[str, Any] = Field( description=f"The origin_data is the same like the response of {VOLUMES_LIST_DOCS_LINKS}", ) - project_name: Optional[str] - attachments: Optional[List[VolumeAttachment]] + project_name: Optional[str] = Field(None, description="Project name") + attachments: Optional[List[VolumeAttachment]] = Field(None, description="Volume attachments") name: Optional[str] = Field( description="Will be removed, please use origin_data[name]", @@ -391,20 +393,20 @@ class ExtListVolumesBaseResponse(BaseModel): ) -class ExtListVolumesResponse(BaseModel): - count: int = 0 - volumes: List[ExtListVolumesBaseResponse] +class VolumesResponse(BaseModel): + count: Optional[int] = Field(0, description="Count of volumes") + volumes: List[VolumesResponseBase] = Field(..., description="Volumes list") -class ExtListVolumeSnapshotsBaseResponse(BaseModel): - id: str +class VolumeSnapshotsResponseBase(BaseModel): + id: str = Field(..., description="Snapshot ID") origin_data: Dict[str, Any] = Field( description=f"The origin_data is the same like the response of {VOLUME_SNAPSHOTS_LIST_DOCS_LINKS}", # noqa ) - project_name: Optional[str] - host: Optional[str] - volume_name: Optional[str] - child_volumes: Optional[List] + project_name: Optional[str] = Field(None, description="Project name") + host: Optional[str] = Field(None, description="Host name") + volume_name: Optional[str] = Field(None, description="Volume name") + child_volumes: Optional[List] = Field(None, description="Child volumes") name: Optional[str] = Field( description="Will be removed, please use origin_data[name]", @@ -436,20 +438,22 @@ class ExtListVolumeSnapshotsBaseResponse(BaseModel): ) -class ExtListVolumeSnapshotsResponse(BaseModel): - count: int = 0 - volume_snapshots: List[ExtListVolumeSnapshotsBaseResponse] +class VolumeSnapshotsResponse(BaseModel): + count: Optional[int] = Field(0, description="Count of volume snapshots") + volume_snapshots: List[VolumeSnapshotsResponseBase] = Field( + ..., description="Volume snapshots list" + ) -class ExtListPortsBaseResponse(BaseModel): - id: str +class PortsResponseBase(BaseModel): + id: str = Field(..., description="Port ID") origin_data: Dict[str, Any] = Field( description=f"The origin_data is the same like the response of {PORTS_LIST_DOCS_LINKS}", # noqa ) - server_name: Optional[str] - network_name: Optional[str] - ipv4: Optional[List] - ipv6: Optional[List] + server_name: Optional[str] = Field(None, description="Server name") + network_name: Optional[str] = Field(None, description="Network name") + ipv4: Optional[List] = Field(None, description="IPv4 addresses") + ipv6: Optional[List] = Field(None, description="IPv6 addresses") name: Optional[str] = Field( description="Will be removed, please use origin_data[name]", @@ -505,21 +509,21 @@ class ExtListPortsBaseResponse(BaseModel): ) -class ExtListPortsResponse(BaseModel): - ports: List[ExtListPortsBaseResponse] +class PortsResponse(BaseModel): + ports: List[PortsResponseBase] = Field(..., description="Ports list") -class ExtListComputeServicesBaseResponse(BaseModel): - id: Optional[str] - binary: str - disabled_reason: Optional[str] - host: str - state: Optional[str] - status: str - updated_at: Optional[str] - forced_down: Optional[bool] - zone: Optional[str] +class ComputeServicesResponseBase(BaseModel): + id: Optional[str] = Field(None, description="Service id") + binary: str = Field(..., description="Service binary") + disabled_reason: Optional[str] = Field(None, description="Disabled reason") + host: str = Field(..., description="Host name") + state: Optional[str] = Field(None, description="Service state") + status: str = Field(..., description="Service status") + updated_at: Optional[str] = Field(None, description="Updated at") + forced_down: Optional[bool] = Field(None, description="Forced down") + zone: Optional[str] = Field(None, description="Zone") -class ExtListComputeServicesResponse(BaseModel): - services: List[ExtListComputeServicesBaseResponse] +class ComputeServicesResponse(BaseModel): + services: List[ComputeServicesResponseBase] = Field(..., description="Services list")