Fix few nova response schemas
- keypair create response does not contain ID - server create response has a response_key (server). This is not really true, since creation may return reservation_id, but this is not typical and we can try to find a solution for that later. For now make sure cli server creation works. Change-Id: I3f52f0e6686767dcc8862543c4c3a155f42ead0e
This commit is contained in:
3 changed files with 46 additions and 13 deletions
@@ -98,7 +98,10 @@ class ComputeMetadata(MetadataBase):
].response_list_item_key = "keypair"
elif resource_name == "server":
if "migrate-live" in operation_name:
if "create" in operation_name:
operation.targets["rust-sdk"].response_key = "server"
operation.targets["rust-cli"].response_key = "server"
elif "migrate-live" in operation_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
@@ -620,10 +620,11 @@ KEYPAIR_LIST_SCHEMA: dict[str, Any] = {
"required": ["keypairs"],
}
KEYPAIR_SCHEMA: dict[str, Any] = {
KEYPAIR_BASE_SCHEMA: dict[str, Any] = {
"type": "object",
"description": "Keypair object",
"properties": {
**copy.deepcopy(KEYPAIR_SHORT_SCHEMA["properties"]),
"user_id": {
"type": "string",
"description": "The user_id for a keypair.",
@@ -647,8 +648,16 @@ KEYPAIR_SCHEMA: dict[str, Any] = {
"format": "date-time",
"description": "It is always null.",
},
"id": {"type": "integer", "description": "The keypair ID."},
},
"required": ["name", "user_id", "type", "fingerprint", "public_key"],
}
KEYPAIR_SHOW_SCHEMA: dict[str, Any] = {
"type": "object",
"description": "Keypair object",
"properties": {
**copy.deepcopy(KEYPAIR_SHORT_SCHEMA["properties"]),
"id": {"type": "integer", "description": "The keypair ID."},
},
"required": ["name", "id", "user_id", "type", "fingerprint", "public_key"],
}
@@ -656,19 +665,34 @@ KEYPAIR_SCHEMA: dict[str, Any] = {
KEYPAIR_CONTAINER_SCHEMA: dict[str, Any] = {
"type": "object",
"description": "Keypair object",
"properties": {"keypair": KEYPAIR_SCHEMA},
"properties": {"keypair": KEYPAIR_SHOW_SCHEMA},
"required": ["keypair"],
}
KEYPAIR_CREATED_SCHEMA: dict[str, Any] = copy.deepcopy(
KEYPAIR_CONTAINER_SCHEMA
)
KEYPAIR_CREATED_SCHEMA["properties"]["keypair"]["properties"][
"private_key"
] = {
"type": "string",
"description": "If you do not provide a public key on create, a new keypair will be built for you, and the private key will be returned during the initial create call. Make sure to save this, as there is no way to get this private key again in the future.",
"x-openstack": {"max-ver": "2.91"},
KEYPAIR_CREATED_SCHEMA: dict[str, Any] = {
"type": "object",
"description": "Keypair object",
"properties": {
"keypair": {
"type": "object",
"properties": {
**copy.deepcopy(KEYPAIR_SHORT_SCHEMA["properties"]),
"private_key": {
"type": "string",
"description": "If you do not provide a public key on create, a new keypair will be built for you, and the private key will be returned during the initial create call. Make sure to save this, as there is no way to get this private key again in the future.",
"x-openstack": {"max-ver": "2.91"},
},
},
"required": [
"name",
"user_id",
"type",
"fingerprint",
"public_key",
],
}
},
"required": ["keypair"],
}
MIGRATION_SCHEMA: dict[str, Any] = {
@@ -937,9 +937,11 @@ resources:
targets:
rust-sdk:
module_name:create
response_key:server
rust-cli:
module_name:create
sdk_mod_name:create
response_key:server
cli_full_command:server create
list_detailed:
operation_id:servers/detail:get
@@ -1063,10 +1065,12 @@ resources:
rust-sdk:
module_name:create_image
operation_name:createImage
response_key:server
rust-cli:
module_name:create_image
sdk_mod_name:create_image
operation_name:createImage
response_key:server
find_implemented_by_sdk:true
cli_full_command:server create-image
os-start:
@@ -1184,10 +1188,12 @@ resources:
rust-sdk:
module_name:create_backup
operation_name:createBackup
response_key:server
rust-cli:
module_name:create_backup
sdk_mod_name:create_backup
operation_name:createBackup
response_key:server
find_implemented_by_sdk:true
cli_full_command:server create-backup
restore:
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.