Merge "Add required to compute service responses"

This commit is contained in:
Zuul 2025-02-28 08:09:33 +00:00 committed by Gerrit Code Review
commit 4515701606

View File

@ -173,6 +173,7 @@ VOLUME_SNAPSHOT_SCHEMA: dict[str, Any] = {
"description": "The source volume ID.", "description": "The source volume ID.",
}, },
}, },
"required": ["id", "volumeId"],
} }
}, },
} }
@ -196,6 +197,7 @@ AZ_SCHEMA: dict[str, Any] = {
}, },
"hosts": {"type": "null", "description": "It is always null."}, "hosts": {"type": "null", "description": "It is always null."},
}, },
"required": ["zoneName", "zoneState"],
} }
AZ_DETAIL_SCHEMA: dict[str, Any] = copy.deepcopy(AZ_SCHEMA) AZ_DETAIL_SCHEMA: dict[str, Any] = copy.deepcopy(AZ_SCHEMA)
@ -231,6 +233,7 @@ AZ_LIST_SCHEMA: dict[str, Any] = {
"items": copy.deepcopy(AZ_SCHEMA), "items": copy.deepcopy(AZ_SCHEMA),
} }
}, },
"required": ["availabilityZoneInfo"],
} }
AZ_LIST_DETAIL_SCHEMA: dict[str, Any] = { AZ_LIST_DETAIL_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -241,6 +244,7 @@ AZ_LIST_DETAIL_SCHEMA: dict[str, Any] = {
"items": copy.deepcopy(AZ_DETAIL_SCHEMA), "items": copy.deepcopy(AZ_DETAIL_SCHEMA),
} }
}, },
"required": ["availabilityZoneInfo"],
} }
CONSOLE_SCHEMA: dict[str, Any] = { CONSOLE_SCHEMA: dict[str, Any] = {
@ -269,6 +273,7 @@ CONSOLE_SCHEMA: dict[str, Any] = {
"required": ["instance_uuid", "port"], "required": ["instance_uuid", "port"],
} }
}, },
"required": ["console"],
} }
REMOTE_CONSOLE_SCHEMA: dict[str, Any] = { REMOTE_CONSOLE_SCHEMA: dict[str, Any] = {
@ -299,8 +304,10 @@ REMOTE_CONSOLE_SCHEMA: dict[str, Any] = {
"description": "The URL is used to connect the console.", "description": "The URL is used to connect the console.",
}, },
}, },
"required": ["protocol", "type", "url"],
} }
}, },
"required": ["remote_console"],
} }
HYPERVISOR_SHORT_SCHEMA: dict[str, Any] = { HYPERVISOR_SHORT_SCHEMA: dict[str, Any] = {
@ -342,9 +349,11 @@ HYPERVISOR_SHORT_SCHEMA: dict[str, Any] = {
"description": "The server name.", "description": "The server name.",
}, },
}, },
"required": ["uuid", "name"],
}, },
}, },
}, },
"required": ["id", "hypervisor_hostname", "state", "servers"],
} }
HYPERVISOR_SCHEMA: dict[str, Any] = { HYPERVISOR_SCHEMA: dict[str, Any] = {
@ -483,6 +492,7 @@ HYPERVISOR_LIST_SCHEMA: dict[str, Any] = {
}, },
"hypervisor_links": LINKS_SCHEMA, "hypervisor_links": LINKS_SCHEMA,
}, },
"required": ["hypervisors"],
} }
HYPERVISOR_LIST_DETAIL_SCHEMA: dict[str, Any] = { HYPERVISOR_LIST_DETAIL_SCHEMA: dict[str, Any] = {
@ -495,6 +505,7 @@ HYPERVISOR_LIST_DETAIL_SCHEMA: dict[str, Any] = {
}, },
"hypervisor_links": LINKS_SCHEMA, "hypervisor_links": LINKS_SCHEMA,
}, },
"required": ["hypervisors"],
} }
INSTANCE_USAGE_AUDIT_SCHEMA: dict[str, Any] = { INSTANCE_USAGE_AUDIT_SCHEMA: dict[str, Any] = {
@ -590,6 +601,7 @@ KEYPAIR_SHORT_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.2"}, "x-openstack": {"min-ver": "2.2"},
}, },
}, },
"required": ["name", "type", "fingerprint", "public_key"],
} }
KEYPAIR_LIST_SCHEMA: dict[str, Any] = { KEYPAIR_LIST_SCHEMA: dict[str, Any] = {
@ -605,6 +617,7 @@ KEYPAIR_LIST_SCHEMA: dict[str, Any] = {
}, },
"keypairs_links": copy.deepcopy(LINKS_SCHEMA), "keypairs_links": copy.deepcopy(LINKS_SCHEMA),
}, },
"required": ["keypairs"],
} }
KEYPAIR_SCHEMA: dict[str, Any] = { KEYPAIR_SCHEMA: dict[str, Any] = {
@ -637,12 +650,14 @@ KEYPAIR_SCHEMA: dict[str, Any] = {
"id": {"type": "integer", "description": "The keypair ID."}, "id": {"type": "integer", "description": "The keypair ID."},
**copy.deepcopy(KEYPAIR_SHORT_SCHEMA["properties"]), **copy.deepcopy(KEYPAIR_SHORT_SCHEMA["properties"]),
}, },
"required": ["name", "id", "user_id", "type", "fingerprint", "public_key"],
} }
KEYPAIR_CONTAINER_SCHEMA: dict[str, Any] = { KEYPAIR_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"description": "Keypair object", "description": "Keypair object",
"properties": {"keypair": KEYPAIR_SCHEMA}, "properties": {"keypair": KEYPAIR_SCHEMA},
"required": ["keypair"],
} }
KEYPAIR_CREATED_SCHEMA: dict[str, Any] = copy.deepcopy( KEYPAIR_CREATED_SCHEMA: dict[str, Any] = copy.deepcopy(
@ -973,8 +988,10 @@ QUOTA_SET_DETAIL_CONTAINER_SCHEMA: dict[str, Any] = {
"x-openstack": {"max-ver": "2.35"}, "x-openstack": {"max-ver": "2.35"},
}, },
}, },
"required": ["id"],
} }
}, },
"required": ["quota_set"],
} }
# TODO(gtema): class set props are not quota_set props, but for now keep this way # TODO(gtema): class set props are not quota_set props, but for now keep this way
QUOTA_CLASS_SET_SCHEMA: dict[str, Any] = { QUOTA_CLASS_SET_SCHEMA: dict[str, Any] = {
@ -987,6 +1004,7 @@ QUOTA_CLASS_SET_SCHEMA: dict[str, Any] = {
}, },
**quota_sets.quota_resources, **quota_sets.quota_resources,
}, },
"required": ["id"],
} }
QUOTA_CLASS_SET_CONTAINER_SCHEMA: dict[str, Any] = { QUOTA_CLASS_SET_CONTAINER_SCHEMA: dict[str, Any] = {
@ -1031,9 +1049,11 @@ EXTERNAL_EVENTS_SCHEMA: dict[str, Any] = {
"description": "A string value that identifies the event.", "description": "A string value that identifies the event.",
}, },
}, },
"required": ["name", "server_uuid", "status"],
}, },
} }
}, },
"required": ["events"],
} }
SERVER_GROUP_POLICIES = [ SERVER_GROUP_POLICIES = [
@ -1099,6 +1119,7 @@ SERVER_GROUP_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.13"}, "x-openstack": {"min-ver": "2.13"},
}, },
}, },
"required": ["id", "user_id", "name", "policy", "project_id"],
} }
SERVER_GROUP_LIST_SCHEMA: dict[str, Any] = { SERVER_GROUP_LIST_SCHEMA: dict[str, Any] = {
@ -1110,10 +1131,12 @@ SERVER_GROUP_LIST_SCHEMA: dict[str, Any] = {
"items": SERVER_GROUP_SCHEMA, "items": SERVER_GROUP_SCHEMA,
} }
}, },
"required": ["server_groups"],
} }
SERVER_GROUP_CONTAINER_SCHEMA: dict[str, Any] = { SERVER_GROUP_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"properties": {"server_group": SERVER_GROUP_SCHEMA}, "properties": {"server_group": SERVER_GROUP_SCHEMA},
"required": ["server_group"],
} }
SERVICE_SCHEMA: dict[str, Any] = { SERVICE_SCHEMA: dict[str, Any] = {
@ -1158,6 +1181,7 @@ SERVICE_SCHEMA: dict[str, Any] = {
"readOnly": True, "readOnly": True,
}, },
}, },
"required": ["zone", "id", "host", "state", "status"],
} }
SERVICE_CONTAINER_SCHEMA: dict[str, Any] = { SERVICE_CONTAINER_SCHEMA: dict[str, Any] = {
@ -1304,6 +1328,7 @@ SERVER_SHORT_SCHEMA: dict[str, Any] = {
"description": "Server name.", "description": "Server name.",
}, },
}, },
"required": ["id", "name"],
} }
SERVER_ADDRESSES_SCHEMA: dict[str, Any] = { SERVER_ADDRESSES_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -1628,6 +1653,7 @@ SERVER_SCHEMA: dict[str, Any] = {
"description": "The VM state of this server.", "description": "The VM state of this server.",
}, },
}, },
"required": ["id", "name", "flavor", "image"],
} }
SERVER_CONTAINER_SCHEMA: dict[str, Any] = { SERVER_CONTAINER_SCHEMA: dict[str, Any] = {
@ -1693,6 +1719,7 @@ SERVER_CREATED_SCHEMA: dict[str, Any] = {
}, },
"links": LINKS_SCHEMA, "links": LINKS_SCHEMA,
}, },
"required": ["id"],
} }
}, },
}, },
@ -1704,6 +1731,7 @@ SERVER_CREATED_SCHEMA: dict[str, Any] = {
"description": "The reservation id for the server. This is an id that can be useful in tracking groups of servers created with multiple create, that will all have the same reservation_id.", "description": "The reservation id for the server. This is an id that can be useful in tracking groups of servers created with multiple create, that will all have the same reservation_id.",
} }
}, },
"required": ["reservation_id"],
}, },
] ]
} }
@ -1726,11 +1754,13 @@ SERVER_ACTION_NEW_ADMINPASS_SCHEMA: dict[str, Any] = {
"description": "An administrative password to access moved instance. If you set enable_instance_password configuration option to False, the API wouldnt return the adminPass field in response.", "description": "An administrative password to access moved instance. If you set enable_instance_password configuration option to False, the API wouldnt return the adminPass field in response.",
} }
}, },
"required": ["adminPass"],
} }
SERVER_ACTION_GET_CONSOLE_OUTPUT_SCHEMA: dict[str, Any] = { SERVER_ACTION_GET_CONSOLE_OUTPUT_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"description": "The console output as a string. Control characters will be escaped to create a valid JSON string.", "description": "The console output as a string. Control characters will be escaped to create a valid JSON string.",
"properties": {"output": {"type": "string"}}, "properties": {"output": {"type": "string"}},
"required": ["output"],
} }
SERVER_ACTION_REMOTE_CONSOLE_SCHEMA: dict[str, Any] = { SERVER_ACTION_REMOTE_CONSOLE_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -1749,8 +1779,10 @@ SERVER_ACTION_REMOTE_CONSOLE_SCHEMA: dict[str, Any] = {
"description": "The URL used to connect to the console.", "description": "The URL used to connect to the console.",
}, },
}, },
"required": ["type", "url"],
} }
}, },
"required": ["console"],
} }
SERVER_DIAGNOSTICS_SCHEMA: dict[str, Any] = { SERVER_DIAGNOSTICS_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -1856,12 +1888,14 @@ SERVER_DIAGNOSTICS_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.48"}, "x-openstack": {"min-ver": "2.48"},
}, },
}, },
"required": ["id", "name"],
} }
SERVER_METADATA_LIST_SCHEMA: dict[str, Any] = { SERVER_METADATA_LIST_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"description": "Metadata key and value pairs. The maximum size for each metadata key and value pair is 255 bytes.", "description": "Metadata key and value pairs. The maximum size for each metadata key and value pair is 255 bytes.",
"properties": {"metadata": parameter_types.metadata}, "properties": {"metadata": parameter_types.metadata},
"required": ["metadata"],
} }
SERVER_METADATA_ITEM_SCHEMA: dict[str, Any] = { SERVER_METADATA_ITEM_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -1917,6 +1951,7 @@ SERVER_INSTANCE_ACTION_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.84"}, "x-openstack": {"min-ver": "2.84"},
}, },
}, },
"required": ["event", "start-time"],
}, },
"description": "Events", "description": "Events",
}, },
@ -1948,10 +1983,12 @@ SERVER_INSTANCE_ACTION_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.58"}, "x-openstack": {"min-ver": "2.58"},
}, },
}, },
"required": ["action", "events", "request_id", "user_id", "project_id"],
} }
SERVER_INSTANCE_ACTION_CONTAINER_SCHEMA: dict[str, Any] = { SERVER_INSTANCE_ACTION_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"properties": {"instanceAction": SERVER_INSTANCE_ACTION_SCHEMA}, "properties": {"instanceAction": SERVER_INSTANCE_ACTION_SCHEMA},
"required": ["instanceAction"],
} }
SERVER_INSTANCE_ACTION_LIST_SCHEMA: dict[str, Any] = { SERVER_INSTANCE_ACTION_LIST_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -1963,6 +2000,7 @@ SERVER_INSTANCE_ACTION_LIST_SCHEMA: dict[str, Any] = {
}, },
"links": LINKS_SCHEMA, "links": LINKS_SCHEMA,
}, },
"required": ["instanceActions"],
} }
INTERFACE_ATTACHMENT_SCHEMA: dict[str, Any] = { INTERFACE_ATTACHMENT_SCHEMA: dict[str, Any] = {
@ -2008,6 +2046,7 @@ INTERFACE_ATTACHMENT_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.70"}, "x-openstack": {"min-ver": "2.70"},
}, },
}, },
"required": ["fixed_ips"],
} }
INTERFACE_ATTACHMENT_CONTAINER_SCHEMA: dict[str, Any] = { INTERFACE_ATTACHMENT_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
@ -2082,6 +2121,7 @@ SERVER_SECURITY_GROUPS_LIST_SCHEMA: dict[str, Any] = {
}, },
}, },
}, },
"required": ["id", "name"],
}, },
} }
}, },
@ -2134,10 +2174,12 @@ VOLUME_ATTACHMENT_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "2.89"}, "x-openstack": {"min-ver": "2.89"},
}, },
}, },
"reuired": ["id", "serverId", "volumeId", "device"],
} }
VOLUME_ATTACHMENT_CONTAINER_SCHEMA: dict[str, Any] = { VOLUME_ATTACHMENT_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"properties": {"volumeAttachment": VOLUME_ATTACHMENT_SCHEMA}, "properties": {"volumeAttachment": VOLUME_ATTACHMENT_SCHEMA},
"required": ["volumeAttachment"],
} }
VOLUME_ATTACHMENT_LIST_SCHEMA: dict[str, Any] = { VOLUME_ATTACHMENT_LIST_SCHEMA: dict[str, Any] = {
@ -2148,6 +2190,7 @@ VOLUME_ATTACHMENT_LIST_SCHEMA: dict[str, Any] = {
"items": VOLUME_ATTACHMENT_SCHEMA, "items": VOLUME_ATTACHMENT_SCHEMA,
} }
}, },
"required": ["volumeAttachments"],
} }
EXTENSION_SCHEMA: dict[str, Any] = { EXTENSION_SCHEMA: dict[str, Any] = {
@ -2174,12 +2217,14 @@ EXTENSION_SCHEMA: dict[str, Any] = {
"description": "The date and time when the resource was updated.", "description": "The date and time when the resource was updated.",
}, },
}, },
"required": ["name", "alias"],
} }
EXTENSION_CONTAINER_SCHEMA: dict[str, Any] = { EXTENSION_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object", "type": "object",
"description": "An extension object.", "description": "An extension object.",
"properties": {"extension": copy.deepcopy(EXTENSION_SCHEMA)}, "properties": {"extension": copy.deepcopy(EXTENSION_SCHEMA)},
"required": ["extension"],
} }
EXTENSION_LIST_SCHEMA: dict[str, Any] = { EXTENSION_LIST_SCHEMA: dict[str, Any] = {
@ -2191,4 +2236,5 @@ EXTENSION_LIST_SCHEMA: dict[str, Any] = {
"items": copy.deepcopy(EXTENSION_SCHEMA), "items": copy.deepcopy(EXTENSION_SCHEMA),
} }
}, },
"required": ["extensions"],
} }