Rename operation_name with action_name in the metadata

Currently we comment the operation_name attribute in the metadata that
it is used as an action name. This only creates confusion especially if
we want to use something different as the operation_name (i.e.
operation_name or opertaion_type for neutron router results in
"action"). So in addition to the renaming of the metadata attribute
explicitly pass the metadata operation key as operation_name parameters
into the generator (when unset).

Change-Id: Ic04eafe5b6dea012ca18b9835cd5c86fefa87055
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
This commit is contained in:
Artem Goncharov
2025-06-05 10:35:48 +02:00
parent 9872d0f590
commit 721705d837
36 changed files with 12656 additions and 11821 deletions

View File

@@ -171,30 +171,28 @@ def main():
"--work-dir", help="Working directory for the generated code"
)
parser.add_argument(
"--alternative-module-path", help=("Optional new module path")
"--alternative-module-path", help="Optional new module path"
)
parser.add_argument(
"--alternative-module-name",
help=("Optional new module name (rename get into list)"),
help="Optional new module name (rename get into list)",
)
parser.add_argument(
"--openapi-yaml-spec", help=("Path to the OpenAPI spec file (yaml)")
"--openapi-yaml-spec", help="Path to the OpenAPI spec file (yaml)"
)
parser.add_argument("--openapi-operation-id", help=("OpenAPI operationID"))
parser.add_argument("--service-type", help=("Catalog service type"))
parser.add_argument("--openapi-operation-id", help="OpenAPI operationID")
parser.add_argument("--service-type", help="Catalog service type")
parser.add_argument(
"--api-version",
help=("Api version (used in path for resulting code, i.e. v1)"),
help="Api version (used in path for resulting code, i.e. v1)",
)
parser.add_argument("--metadata", help=("Metadata file to load"))
parser.add_argument("--service", help=("Metadata service name filter"))
parser.add_argument("--resource", help=("Metadata resource name filter"))
parser.add_argument("--metadata", help="Metadata file to load")
parser.add_argument("--service", help="Metadata service name filter")
parser.add_argument("--resource", help="Metadata resource name filter")
parser.add_argument(
"--validate",
action="store_true",
help=("Metadata resource name filter"),
"--validate", action="store_true", help="Metadata resource name filter"
)
generators = {
@@ -242,7 +240,8 @@ def main():
op_args.api_version = res_data.api_version
if not op_args.operation_type and op_data.operation_type:
op_args.operation_type = op_data.operation_type
# if not op_data.alternative_module_name and args.target == "rust-sdk":
if not op_args.operation_name:
op_args.operation_name = op_args.module_name or op
openapi_spec = generator.get_openapi_spec(
Path(

View File

@@ -51,6 +51,56 @@ def _deep_merge(
return result
def sort_schema(data: Any):
def schema_tag_order(item):
orders = {
"openapi": 0,
"info": 1,
"jsonSchemaDialect": 2,
"servers": 3,
"paths": 4,
"components": 5,
"security": 6,
"webhooks": 7,
"tags": 8,
"externalDocs": 9,
}
return orders.get(item[0], item[0])
return {
key: sort_data(value)
for key, value in sorted(data.items(), key=schema_tag_order)
}
def sort_data(data: Any):
def get_key(item: Any) -> str:
if isinstance(item, dict):
return str(item)
elif isinstance(item, (str, bool, int, float)):
return str(item)
elif item is None:
return ""
else:
raise RuntimeError(f"Cannot determine key for {item}")
if isinstance(data, dict):
return {
key: sort_data(value)
for key, value in sorted(data.items(), key=lambda item: item[0])
}
elif isinstance(data, list):
return [sort_data(item) for item in sorted(data, key=get_key)]
elif isinstance(data, tuple):
return [sort_data(item) for item in sorted(data, key=get_key)]
elif isinstance(data, (str, bool, int, float)):
return data
elif data is None:
return data
else:
raise RuntimeError(f"Cannot sort {data} [{type(data)}]")
class BasePrimitiveType(BaseModel):
lifetimes: set[str] | None = None
builder_macros: set[str] = set()
@@ -352,7 +402,7 @@ def find_response_schema(
return None
def get_operation_variants(spec: dict, operation_name: str):
def get_operation_variants(spec: dict, action_name: str | None = None):
"""Find operation body suitable for the generator"""
request_body = spec.get("requestBody")
# List of operation variants (based on the body)
@@ -367,9 +417,10 @@ def get_operation_variants(spec: dict, operation_name: str):
if "oneOf" in json_body_schema and "type" not in json_body_schema:
# There is a choice of bodies. It can be because of
# microversion or an action (or both)
# For action we should come here with operation_type="action" and operation_name must be the action name
# For action we should come here with operation_type="action"
# and operation_name must be the action name.
# For microversions we build body as enum
# So now try to figure out what the discriminator is
# So now try to figure out what the discriminator is.
discriminator = json_body_schema.get("x-openstack", {}).get(
"discriminator"
)
@@ -380,19 +431,19 @@ def get_operation_variants(spec: dict, operation_name: str):
operation_variants.append(
{"body": variant, "mime_type": mime_type}
)
# operation_variants.extend([{"body": x} for x in json_body_schema(["oneOf"])])
elif discriminator == "action":
elif discriminator == "action" and action_name:
# We are in the action. Need to find matching body
for variant in json_body_schema["oneOf"]:
variant_spec = variant.get("x-openstack", {})
if variant_spec.get("action-name") == operation_name:
if variant_spec.get("action-name") == action_name:
discriminator = variant_spec.get("discriminator")
if (
"oneOf" in variant
and discriminator == "microversion"
):
logging.debug(
"Microversion discriminator for action bodies"
"Microversion discriminator for action"
" bodies"
)
for subvariant in variant["oneOf"]:
subvariant_spec = subvariant.get(
@@ -423,7 +474,8 @@ def get_operation_variants(spec: dict, operation_name: str):
break
if not operation_variants:
raise RuntimeError(
f"Cannot find body specification for action {operation_name}"
"Cannot find body specification for action"
f" {action_name}"
)
else:
raise RuntimeError(

View File

@@ -22,7 +22,6 @@ from codegenerator.common import BaseCompoundType
from codegenerator import model
from codegenerator import common
CODEBLOCK_RE = re.compile(r"```(\w*)$")
@@ -812,7 +811,8 @@ class TypeManager:
typ = Boolean()
else:
raise RuntimeError(
f"Rust model does not support multitype enums yet {type_model}"
"Rust model does not support multitype enums yet"
f" {type_model}"
)
elif len(type_model.base_types) == 1:
base_type = type_model.base_types[0]
@@ -858,7 +858,8 @@ class TypeManager:
if not typ:
raise RuntimeError(
f"Cannot map model type {type_model.__class__.__name__} to Rust type [{type_model}]"
f"Cannot map model type {type_model.__class__.__name__} to"
f" Rust type [{type_model}]"
)
if not model_ref:
@@ -1167,14 +1168,18 @@ class TypeManager:
some_model.name = new_other_name
unique_models[new_other_name] = some_model
logging.debug(
f"Renaming also {some_model} into {new_other_name} for consistency"
f"Renaming also {some_model} into"
f" {new_other_name} for consistency"
)
else:
if model_.reference.hash_ == unique_models[new_name].hash_:
if name != self.refs[unique_models[name]].name:
logging.debug(
f"Found that same model {model_.reference} that we previously renamed to {self.refs[unique_models[name]].name}"
"Found that same model"
f" {model_.reference} that we previously"
" renamed to"
f" {self.refs[unique_models[name]].name}"
)
pass
# not sure whether the new name should be save
@@ -1216,7 +1221,8 @@ class TypeManager:
)
else:
raise RuntimeError(
f"Model name {new_name} is already present as {type(model_data_type)}"
f"Model name {new_name} is already present as"
f" {type(model_data_type)}"
)
elif (
name
@@ -1275,7 +1281,8 @@ class TypeManager:
):
# A body with only field can not normally be optional
logging.warning(
"Request body with single root field cannot be optional"
"Request body with single root field cannot be"
" optional"
)
v.fields[field_names[0]].is_optional = False
return v
@@ -1340,7 +1347,8 @@ class TypeManager:
)
if param.local_name in self.parameters:
raise RuntimeError(
f"Parameter with the name {param.local_name} is already present"
f"Parameter with the name {param.local_name} is already"
" present"
)
self.parameters[param.local_name] = param
@@ -1392,7 +1400,8 @@ class TypeManager:
self.discard_model(sub_ref)
elif ref.type == model.Array:
logging.debug(
f"Element is a Array. Purging also item type {type_model.item_type}"
"Element is a Array. Purging also item type"
f" {type_model.item_type}"
)
if isinstance(type_model.item_type, model.Reference):
sub_ref = type_model.item_type

View File

@@ -43,7 +43,6 @@ from codegenerator.types import OperationModel
from codegenerator.types import OperationTargetParams
from codegenerator.types import ResourceModel
OPERATION_ID_BLACKLIST: set[str] = {
# # BlockStorage
# ## Host put has no schema
@@ -58,7 +57,9 @@ SERVICE_METADATA_MAP: dict[str, ty.Type[MetadataBase]] = {
"block-storage": BlockStorageMetadata,
"volume": BlockStorageMetadata,
"compute": ComputeMetadata,
"container-infrastructure-management": ContainerInfrastructureManagementMetadata,
"container-infrastructure-management": (
ContainerInfrastructureManagementMetadata
),
"dns": DnsMetadata,
"identity": IdentityMetadata,
"image": ImageMetadata,
@@ -108,8 +109,10 @@ class MetadataGenerator(BaseGenerator):
metadata_path.parent.mkdir(exist_ok=True, parents=True)
with open(metadata_path, "w") as fp:
yaml.dump(
metadata.model_dump(
exclude_none=True, exclude_defaults=True, by_alias=True
common.sort_schema(
metadata.model_dump(
exclude_none=True, exclude_defaults=True, by_alias=True
)
),
fp,
)
@@ -216,7 +219,9 @@ class MetadataGenerator(BaseGenerator):
if skip:
continue
logging.debug(
f"Got {operation_key} as a key for {operation.operationId} as an override from service metadata processor"
f"Got {operation_key} as a key for"
f" {operation.operationId} as an override from service"
" metadata processor"
)
if not operation_key:
@@ -342,7 +347,9 @@ class MetadataGenerator(BaseGenerator):
).get("discriminator")
if discriminator != "action":
raise RuntimeError(
f"Cannot generate metadata for {path} since request body is not having action discriminator"
"Cannot generate metadata for"
f" {path} since request body is"
" not having action discriminator"
)
for body in bodies:
action_name = body.get(
@@ -377,7 +384,7 @@ class MetadataGenerator(BaseGenerator):
rust_sdk_params = (
get_rust_sdk_operation_args(
"action",
operation_name=action_name,
action_name=action_name,
module_name=get_module_name(
action_name
),
@@ -386,7 +393,7 @@ class MetadataGenerator(BaseGenerator):
rust_cli_params = (
get_rust_cli_operation_args(
"action",
operation_name=action_name,
action_name=action_name,
module_name=get_module_name(
action_name
),
@@ -587,7 +594,7 @@ def get_operation_type_by_key(operation_key):
def get_rust_sdk_operation_args(
operation_key: str,
operation_name: str | None = None,
action_name: str | None = None,
module_name: str | None = None,
):
"""Construct proper Rust SDK parameters for operation by type"""
@@ -604,14 +611,14 @@ def get_rust_sdk_operation_args(
# get_operation_type_by_key(operation_key)
operation_key
)
sdk_params.operation_name = operation_name
sdk_params.action_name = action_name
return sdk_params
def get_rust_cli_operation_args(
operation_key: str,
operation_name: str | None = None,
action_name: str | None = None,
module_name: str | None = None,
resource_name: str | None = None,
):
@@ -619,12 +626,12 @@ def get_rust_cli_operation_args(
# Get SDK params to connect things with each other
# operation_type = get_operation_type_by_key(operation_key)
sdk_params = get_rust_sdk_operation_args(
operation_key, operation_name=operation_name, module_name=module_name
operation_key, action_name=action_name, module_name=module_name
)
cli_params = OperationTargetParams()
cli_params.sdk_mod_name = sdk_params.module_name
cli_params.module_name = module_name or get_module_name(operation_key)
cli_params.operation_name = operation_name
cli_params.action_name = action_name
if resource_name:
op_name = cli_params.module_name
if op_name.startswith("os_") or op_name.startswith("os-"):

View File

@@ -28,6 +28,6 @@ class BaremetalMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
return operation

View File

@@ -45,7 +45,7 @@ class BlockStorageMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name == "type":
if operation_name == "list":
@@ -60,27 +60,30 @@ class BlockStorageMetadata(MetadataBase):
if "/tag" in resource_name:
if operation_name == "update":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
elif operation_name == "show":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if resource_name == "snapshot":
if "update-snapshot-status" in operation_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"update-snapshot-status", "update-status"
)
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"update-snapshot-status", "update-status"
)
if resource_name in ["os_volume_transfer", "volume_transfer"]:
if operation_name in ["list", "list_detailed"]:
@@ -129,9 +132,12 @@ class BlockStorageMetadata(MetadataBase):
operation.targets["rust-sdk"].response_key = "limits"
if operation_name == "delete_all":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if resource_name in ["backup", "snapshot", "volume"]:
if operation_name in ["list_detailed", "delete"]:

View File

@@ -13,7 +13,6 @@
import typing as ty
from codegenerator.types import OperationModel
from codegenerator.types import OperationTargetParams
from codegenerator.metadata.base import MetadataBase
@@ -25,7 +24,6 @@ class ComputeMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if resource_name == "flavor/flavor_access" and method == "get":
operation_key = "list"
@@ -223,8 +221,6 @@ class ComputeMetadata(MetadataBase):
"rust-sdk"
].module_name.replace("os_", "")
op.sdk_mod_name = operation.targets["rust-sdk"].module_name
op.operation_name = operation.targets[
"rust-sdk"
].operation_name
op.action_name = operation.targets["rust-sdk"].action_name
return operation

View File

@@ -28,6 +28,6 @@ class ContainerInfrastructureManagementMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
return operation

View File

@@ -25,7 +25,6 @@ class DnsMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if resource_name == "zone/task":
if path == "/v2/zones/{zone_id}/tasks/xfr":
@@ -44,7 +43,7 @@ class DnsMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name in ["zone", "recordset", "zone/recordset"]:
if operation_name in ["list", "delete"]:

View File

@@ -68,7 +68,7 @@ class IdentityMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name == "role/imply":
if operation_name == "list":
@@ -90,17 +90,21 @@ class IdentityMetadata(MetadataBase):
if "rust-cli" in operation.targets:
if "OS_FEDERATION" in resource_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("OS-FEDERATION", "federation")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("OS-FEDERATION", "federation")
if "OS_EP_FILTER" in resource_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("OS-EP-FILTER", "endpoint-filter")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"OS-EP-FILTER", "endpoint-filter"
)
elif resource_name == "user/project":
operation.targets[
"rust-cli"
@@ -108,38 +112,47 @@ class IdentityMetadata(MetadataBase):
elif resource_name == "user/group":
operation.targets["rust-cli"].cli_full_command = "user groups"
elif resource_name == "user/access_rule":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("user access-rule", "access-rule")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"user access-rule", "access-rule"
)
elif resource_name == "user/application_credential":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"user application-credential", "application-credential"
)
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"user application-credential", "application-credential"
)
if "/tag" in resource_name:
if operation_name == "update":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
elif operation_name == "show":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation_name == "delete_all":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if resource_name in [
"auth/project",

View File

@@ -25,7 +25,6 @@ class ImageMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if path == "/v2/images/{image_id}/file":
if method == "put":
@@ -43,14 +42,17 @@ class ImageMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name.startswith("schema"):
# Image schemas are a JSON operation
operation.targets["rust-cli"].operation_type = "json"
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("get", "show")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("get", "show")
elif resource_name == "metadef/namespace" and operation_name != "list":
operation.targets["rust-sdk"].response_key = "null"
operation.targets["rust-cli"].response_key = "null"
@@ -68,41 +70,53 @@ class ImageMetadata(MetadataBase):
operation.targets[
"rust-sdk"
].response_key = "resource_type_associations"
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"resource-type", "resource-type-association"
)
elif resource_name == "image":
if operation_name == "patch":
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("patch", "set")
].cli_full_command.replace(
"resource-type", "resource-type-association"
)
elif resource_name == "image":
if operation_name == "patch":
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("patch", "set")
elif resource_name == "image/file":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("file ", "")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("file ", "")
if "/tag" in resource_name:
if operation_name == "update":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
elif operation_name == "show":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation_name == "delete_all":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if resource_name in ["image"]:
if operation_name in ["list", "delete"]:

View File

@@ -28,6 +28,6 @@ class KeyManagerMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
return operation

View File

@@ -39,7 +39,7 @@ class LoadBalancerMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name in [
"healthmonitor",

View File

@@ -25,7 +25,6 @@ class NetworkMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if "quota" in path and path.endswith("/default"):
# normalize "defaults" name
@@ -37,55 +36,66 @@ class NetworkMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name.startswith("floatingip"):
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("floatingip", "floating-ip")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("floatingip", "floating-ip")
if resource_name == "router":
if "external_gateways" in operation_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"external-gateways", "external-gateway"
)
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace(
"external-gateways", "external-gateway"
)
elif "extraroutes" in operation_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("extraroutes", "extraroute")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("extraroutes", "extraroute")
if resource_name == "address_group":
if "addresses" in operation_name:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("addresses", "address")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("addresses", "address")
if "/tag" in resource_name:
if operation_name == "update":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("set", "add")
elif operation_name == "show":
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("show", "check")
if operation_name == "delete_all":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if operation.targets["rust-cli"].cli_full_command:
operation.targets[
"rust-cli"
].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
if resource_name in [
"network",

View File

@@ -24,7 +24,6 @@ class ObjectStorageMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if resource_name == "object":
mapping_obj: dict[str, str] = {
@@ -58,7 +57,7 @@ class ObjectStorageMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name == "account":
if operation_name == "get":

View File

@@ -24,7 +24,6 @@ class PlacementMetadata(MetadataBase):
) -> ty.Tuple[str | None, bool]:
skip: bool = False
operation_key: str | None = None
path_elements: list[str] = path.split("/")
if (
resource_name
@@ -47,7 +46,7 @@ class PlacementMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
if resource_name == "allocation_candidate":
if operation_name == "list":
@@ -62,8 +61,8 @@ class PlacementMetadata(MetadataBase):
if operation_name == "list":
operation.operation_type = "show"
if operation_name == "delete_all":
operation.targets["rust-cli"].cli_full_command = operation.targets[
"rust-cli"
].cli_full_command.replace("delete-all", "purge")
operation.targets["rust-cli"].cli_full_command = (
operation.targets["rust-cli"].cli_full_command or "purge"
).replace("delete-all", "purge")
return operation

View File

@@ -28,6 +28,6 @@ class SharedFileSystemMetadata(MetadataBase):
@staticmethod
def post_process_operation(
resource_name: str, operation_name: str, operation
resource_name: str, operation_name: str, operation: OperationModel
):
return operation

View File

@@ -229,15 +229,15 @@ class OpenStackServerSourceBase:
):
openapi_parser.parse_parameter(param)
op_name: str | None = None
action_name: str | None = None
response_key: str | None = None
sdk_target = operation_spec.targets.get("rust-sdk")
if sdk_target:
op_name = sdk_target.operation_name
action_name = sdk_target.action_name
response_key = sdk_target.response_key
operation_variants = common.get_operation_variants(
spec, op_name or operation_name
spec, action_name=action_name
)
for operation_variant in operation_variants:

View File

@@ -24,7 +24,6 @@ from codegenerator.common import BasePrimitiveType
from codegenerator.common import BaseCombinedType
from codegenerator.common import BaseCompoundType
BASIC_FIELDS = [
"id",
"name",
@@ -235,11 +234,13 @@ class DictionaryInput(common_rust.Dictionary):
if not isinstance(self.value_type, common_rust.Option):
macros.add(
f"value_parser=parse_key_val::<String, {self.value_type.type_hint}>"
"value_parser=parse_key_val::<String,"
f" {self.value_type.type_hint}>"
)
else:
macros.add(
f"value_parser=parse_key_val_opt::<String, {self.value_type.item_type.type_hint}>"
"value_parser=parse_key_val_opt::<String,"
f" {self.value_type.item_type.type_hint}>"
)
return macros
@@ -436,7 +437,8 @@ class RequestTypeManager(common_rust.TypeManager):
):
# The only field is null. No input is necessary
logging.debug(
"API accepts only 1 field of type Null. No input is required."
"API accepts only 1 field of type Null. No input is"
" required."
)
type_model.fields = {}
if isinstance(type_model, model.Array):
@@ -572,8 +574,9 @@ class RequestTypeManager(common_rust.TypeManager):
dict_type_model.value_type.reference
)
elif isinstance(field_data_type, StructInput):
# Check if one of the sub fields has same attribute name as in the current struct.
# Ideally this should not ever happen, but i.e. image.namespace.property has the case
# Check if one of the sub fields has same attribute name as in
# the current struct. Ideally this should not ever happen, but
# i.e. image.namespace.property has the case
intersect = set(type_model.fields.keys()).intersection(
set(field_data_type.fields.keys())
)
@@ -702,12 +705,18 @@ class RustCliGenerator(BaseGenerator):
)
parser.add_argument(
"--cli-mod-path",
help="Mod path (dot separated) of the corresponding SDK command (when non standard)",
help=(
"Mod path (dot separated) of the corresponding SDK command"
" (when non standard)"
),
)
parser.add_argument(
"--sdk-mod-path",
help="Mod path (dot separated) of the corresponding SDK command (when non standard)",
help=(
"Mod path (dot separated) of the corresponding SDK command"
" (when non standard)"
),
)
parser.add_argument(
@@ -791,14 +800,15 @@ class RustCliGenerator(BaseGenerator):
)
global_additional_imports.add("openstack_sdk::api::QueryAsync")
global_additional_imports.add(
f"openstack_sdk::api::{'::'.join(link_res_name.split('/'))}::find as find_{link_res_name.split('/')[-1]}"
f"openstack_sdk::api::{'::'.join(link_res_name.split('/'))}::find"
f" as find_{link_res_name.split('/')[-1]}"
)
global_additional_imports.add("eyre::OptionExt")
global_additional_imports.add("eyre::eyre")
# List of operation variants (based on the body)
operation_variants = common.get_operation_variants(
spec, args.operation_name
spec, action_name=args.action_name
)
body_types: list[str] = []
@@ -893,11 +903,7 @@ class RustCliGenerator(BaseGenerator):
response = common.find_response_schema(
spec["responses"],
args.response_key or resource_name,
(
args.operation_name
if args.operation_type == "action"
else None
),
args.action_name,
)
if response:
@@ -1103,10 +1109,12 @@ class RustCliGenerator(BaseGenerator):
"operation_id": operation_id,
"operation_type": args.operation_type,
"operation_name": (
args.operation_name or args.operation_type
).lower(),
"command_description": common_rust.sanitize_rust_docstrings(
command_description
(args.operation_name or args.operation_type).lower()
),
"command_description": (
common_rust.sanitize_rust_docstrings(
command_description
)
),
"command_summary": common_rust.sanitize_rust_docstrings(
command_summary

View File

@@ -17,12 +17,8 @@ import subprocess
from typing import Type, Any
from codegenerator.base import BaseGenerator
from codegenerator.common import BasePrimitiveType
from codegenerator.common import BaseCombinedType
from codegenerator.common import BaseCompoundType
from codegenerator import common
from codegenerator import model
from codegenerator.common import BaseCompoundType
from codegenerator.common import rust as common_rust
@@ -203,8 +199,9 @@ class BTreeMap(common_rust.Dictionary):
"Cow<'a, str>", "String"
)
return (
f"BTreeMap::<String, BTreeMap<String, {type_hint}>>::new().into_iter()"
f".map(|(k, v)| (k, v.into_iter()))"
"BTreeMap::<String, BTreeMap<String,"
f" {type_hint}>>::new().into_iter().map(|(k, v)| (k,"
" v.into_iter()))"
)
else:
type_hint = self.value_type.type_hint.replace(
@@ -356,12 +353,19 @@ class RustSdkGenerator(BaseGenerator):
def get_parser(self, parser):
parser.add_argument(
"--response-key",
help="Rust SDK response key (only required when normal detection does not work)",
help=(
"Rust SDK response key (only required when normal detection"
" does not work)"
),
)
parser.add_argument(
"--response-list-item-key",
help='Rust SDK list response item key (specifies whether list items are wrapped in additional container `{"keypairs":["keypair":{}]}`)',
help=(
"Rust SDK list response item key (specifies whether list items"
" are wrapped in additional container"
' `{"keypairs":["keypair":{}]}`)'
),
)
return parser
@@ -435,7 +439,7 @@ class RustSdkGenerator(BaseGenerator):
# Process body information
# List of operation variants (based on the body)
operation_variants = common.get_operation_variants(
spec, args.operation_name
spec, action_name=args.action_name
)
api_ver_matches: re.Match | None = None

View File

@@ -26,7 +26,6 @@ from codegenerator.common import rust as common_rust
from codegenerator.rust_sdk import TypeManager as SdkTypeManager
from codegenerator import rust_sdk
BASIC_FIELDS = [
"name",
"title",
@@ -92,7 +91,10 @@ class ArrayInput(common_rust.Array):
ord_num += 1
result: str = source_var_name
if isinstance(self.item_type, common_rust.BaseCompoundType):
result += f".iter().flat_map(|x| TryFrom::try_from(x)).collect::<Vec<{'::'.join(sdk_mod_path)}::{self.item_type.name}>>()"
result += (
".iter().flat_map(|x|"
f" TryFrom::try_from(x)).collect::<Vec<{'::'.join(sdk_mod_path)}::{self.item_type.name}>>()"
)
elif isinstance(self.item_type, ArrayInput) and isinstance(
self.item_type.item_type, common_rust.BasePrimitiveType
):
@@ -165,7 +167,10 @@ class Struct(rust_sdk.Struct):
def get_sdk_builder_try_from(
self, sdk_struct: rust_sdk.Struct, sdk_mod_path: list[str]
) -> str:
result: str = f"impl TryFrom<&{self.name}> for {'::'.join(sdk_mod_path)}::{sdk_struct.name}Builder{sdk_struct.static_lifetime_anonymous} {{"
result: str = (
f"impl TryFrom<&{self.name}> for"
f" {'::'.join(sdk_mod_path)}::{sdk_struct.name}Builder{sdk_struct.static_lifetime_anonymous} {{"
)
result += "type Error = Report;\n"
result += (
f"fn try_from(value: &{self.name}) -> Result<Self, Self::Error> {{"
@@ -202,12 +207,25 @@ class Struct(rust_sdk.Struct):
def get_sdk_type_try_from(
self, sdk_struct: rust_sdk.Struct, sdk_mod_path: list[str]
) -> str:
result: str = f"impl TryFrom<&{self.name}> for {'::'.join(sdk_mod_path)}::{sdk_struct.name}{sdk_struct.static_lifetime_anonymous} {{"
result: str = (
f"impl TryFrom<&{self.name}> for"
f" {'::'.join(sdk_mod_path)}::{sdk_struct.name}{sdk_struct.static_lifetime_anonymous} {{"
)
result += "type Error = Report;\n"
result += f"fn try_from(value: &{self.name}) -> Result<Self, Self::Error> {{\n"
result += f"let ep_builder: {'::'.join(sdk_mod_path)}::{sdk_struct.name}Builder = TryFrom::try_from(value)?;\n"
result += (
f"fn try_from(value: &{self.name}) -> Result<Self, Self::Error>"
" {\n"
)
result += (
"let ep_builder:"
f" {'::'.join(sdk_mod_path)}::{sdk_struct.name}Builder ="
" TryFrom::try_from(value)?;\n"
)
result += f'ep_builder.build().wrap_err("cannot prepare request element `{self.name}`")'
result += (
'ep_builder.build().wrap_err("cannot prepare request element'
f' `{self.name}`")'
)
result += "}\n"
result += "}"
return result
@@ -350,7 +368,7 @@ class RustTuiGenerator(BaseGenerator):
# Process body information
# List of operation variants (based on the body)
operation_variants = common.get_operation_variants(
spec, args.operation_name
spec, action_name=args.action_name
)
api_ver_matches: re.Match | None = None

View File

@@ -14,15 +14,10 @@ import logging
from pathlib import Path
import re
import subprocess
from typing import Type, Any
from codegenerator.base import BaseGenerator
from codegenerator.common import BasePrimitiveType
from codegenerator.common import BaseCombinedType
from codegenerator.common import BaseCompoundType
from codegenerator import common
from codegenerator import model
from codegenerator.common import BaseCompoundType
from codegenerator.common import rust as common_rust
@@ -265,17 +260,15 @@ class RustTypesGenerator(BaseGenerator):
return
# srv_name, resource_name = res.split(".") if res else (None, None)
path_resources = common.get_resource_names_from_url(path)
resource_name = common.get_resource_names_from_url(path)[-1]
mime_type = None
openapi_parser = model.OpenAPISchemaParser()
# Collect all operation parameters
# Process body information
# List of operation variants (based on the body)
operation_variants = common.get_operation_variants(
spec, args.operation_name
spec, action_name=args.action_name
)
api_ver_matches: re.Match | None = None
@@ -294,8 +287,6 @@ class RustTypesGenerator(BaseGenerator):
ResponseTypeManager()
)
additional_imports = set()
result_is_list: bool = False
is_list_paginated: bool = False
if api_ver_matches:
api_ver = {
@@ -310,7 +301,6 @@ class RustTypesGenerator(BaseGenerator):
for x in re.split(common.SPLIT_NAME_RE, resource_name)
)
response_type_manager.root_name = class_name + "Response"
operation_body = operation_variant.get("body")
mod_name = "_".join(
x.lower()
for x in re.split(
@@ -332,20 +322,14 @@ class RustTypesGenerator(BaseGenerator):
mod_path.append("response")
response_key: str | None = None
result_def: dict = {}
response_def: dict | None = {}
resource_header_metadata: dict = {}
# Get basic information about response
if method.upper() != "HEAD":
response = common.find_response_schema(
spec["responses"],
args.response_key or resource_name,
(
args.operation_name
if args.operation_type == "action"
else None
),
args.action_name,
)
if response:
if args.response_key:
@@ -393,8 +377,6 @@ class RustTypesGenerator(BaseGenerator):
# simplification, so just downcast it to
# JsonValue (what is anyway our goal)
value_type = common_rust.JsonValue()
# if not isinstance(value_type, common_rust.BasePrimitiveType):
# value_type = JsonValue(original_data_type=value_type)
root_dict = common_rust.HashMapResponse(
name=response_type_manager.root_name,
value_type=value_type,
@@ -444,16 +426,6 @@ class RustTypesGenerator(BaseGenerator):
)
response_type_manager.set_models(response_types)
response_props = response.get("properties", {})
if (
response_props
and response_props[
list(response_props.keys())[0]
].get("type")
== "array"
):
result_is_list = True
else:
return

View File

@@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from collections import OrderedDict
import json
from unittest import TestCase
from typing import Any
@@ -17,6 +19,158 @@ from typing import Any
from codegenerator import common
class TestSortSchema(TestCase):
def test_sort_dict(self):
self.assertEqual(
json.dumps({"a": "b", "b": 2, "c": "foo", "d": "bar"}),
json.dumps(
common.sort_data({"b": 2, "c": "foo", "d": "bar", "a": "b"})
),
)
def test_sort_dict_of_dicts(self):
self.assertEqual(
json.dumps(
{
"components": {
"schemas": {
"Bar": {"enum": ["1", "2", "4"], "type": "string"},
"Foo": {
"description": "foo",
"properties": {
"m": {"type": ["null", "string"]},
"z": {"type": "string"},
},
"type": "object",
},
}
}
}
),
json.dumps(
common.sort_data(
{
"components": {
"schemas": {
"Foo": {
"type": "object",
"description": "foo",
"properties": {
"z": {"type": "string"},
"m": {"type": ["string", "null"]},
},
},
"Bar": {
"type": "string",
"enum": ["1", "4", "2"],
},
}
}
}
)
),
)
def test_sort_spec(self):
self.assertEqual(
{
"openapi": "3.1.0",
"info": {"title": "foo"},
"components": {
"schemas": {
"Bar": {"type": "string", "enum": ["1", "2", "4"]},
"Baz": {"enum": [1, 2.3, "4", True]},
"Foo": {
"description": "foo",
"properties": {
"m": {"type": ["null", "string"]},
"z": {"type": "string"},
},
"type": "object",
},
}
},
},
common.sort_data(
{
"components": {
"schemas": {
"Foo": {
"type": "object",
"description": "foo",
"properties": {
"z": {"type": "string"},
"m": {"type": ["string", "null"]},
},
},
"Baz": {"enum": [1, 2.3, "4", True]},
"Bar": {"type": "string", "enum": ["1", "4", "2"]},
}
},
"info": {"title": "foo"},
"openapi": "3.1.0",
}
),
)
def test_order(self):
expected = OrderedDict(
{
"projects_not-tags": OrderedDict(
{
"in": "query",
"name": "not-tags",
"schema": {
"type": "string",
"x-openstack": {
"openapi": {
"schema": {
"explode": "false",
"items": {
"maxLength": 255,
"minLength": 1,
"pattern": "^[^,/]*$",
"type": "string",
},
"style": "form",
"type": "array",
}
}
},
},
}
)
}
)
unordered = {
"projects_not-tags": {
"name": "not-tags",
"in": "query",
"schema": {
"type": "string",
"x-openstack": {
"openapi": {
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[^,/]*$",
},
"style": "form",
"explode": "false",
}
}
},
},
}
}
self.assertEqual(
json.dumps(expected), json.dumps(common.sort_data(unordered))
)
class TestFindResponseSchema(TestCase):
FOO = {"foo": {"type": "string"}}

View File

@@ -15,7 +15,6 @@ from unittest import TestCase
from codegenerator import model
SAMPLE_SERVER_SCHEMA = {
"type": "object",
"properties": {
@@ -250,7 +249,10 @@ SAMPLE_SERVER_SCHEMA = {
"minLength": 1,
"maxLength": 255,
"format": "name",
"description": "A target cell name. Schedule the server in a host in the cell specified.",
"description": (
"A target cell name. Schedule the server"
" in a host in the cell specified."
),
}
},
"additionalProperties": False,
@@ -341,7 +343,10 @@ SAMPLE_SERVER_SCHEMA = {
"build_near_host_ip": {
"type": "string",
"oneOf": [{"format": "ipv4"}, {"format": "ipv6"}],
"description": "Schedule the server on a host in the network specified with",
"description": (
"Schedule the server on a host in the network"
" specified with"
),
},
"cidr": {"type": "string", "pattern": "^/[0-9a-f.:]+$"},
},
@@ -359,7 +364,12 @@ SAMPLE_SERVER_SCHEMA = {
"items": {"type": "string", "format": "uuid"},
},
],
"description": "A list of server UUIDs or a server UUID.\nSchedule the server on a different host from a set of servers.\nIt is available when `DifferentHostFilter` is available on cloud side.",
"description": (
"A list of server UUIDs or a server UUID.\nSchedule"
" the server on a different host from a set of"
" servers.\nIt is available when `DifferentHostFilter`"
" is available on cloud side."
),
},
"same_host": {
"type": ["string", "array"],
@@ -690,7 +700,10 @@ EXPECTED_DATA_TYPES = [
data_type=model.ConstraintString(
format="name", minLength=1, maxLength=255
),
description="A target cell name. Schedule the server in a host in the cell specified.",
description=(
"A target cell name. Schedule the server in a host in the"
" cell specified."
),
)
},
min_ver="2.94",
@@ -978,7 +991,10 @@ EXPECTED_DATA_TYPES = [
data_type=model.Reference(
name="build_near_host_ip", type=model.OneOfType
),
description="Schedule the server on a host in the network specified with",
description=(
"Schedule the server on a host in the network specified"
" with"
),
min_ver="2.94",
),
"cidr": model.StructField(
@@ -1068,7 +1084,12 @@ EXPECTED_DATA_TYPES = [
data_type=model.Reference(
name="different_host", type=model.OneOfType
),
description="A list of server UUIDs or a server UUID.\nSchedule the server on a different host from a set of servers.\nIt is available when `DifferentHostFilter` is available on cloud side.",
description=(
"A list of server UUIDs or a server UUID.\nSchedule the"
" server on a different host from a set of servers.\nIt is"
" available when `DifferentHostFilter` is available on"
" cloud side."
),
min_ver="2.94",
),
"same_host": model.StructField(

View File

@@ -10,160 +10,3 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from collections import OrderedDict
import json
from unittest import TestCase
from codegenerator.openapi import base
class TestSortSchema(TestCase):
def test_sort_dict(self):
self.assertEqual(
json.dumps({"a": "b", "b": 2, "c": "foo", "d": "bar"}),
json.dumps(
base.sort_data({"b": 2, "c": "foo", "d": "bar", "a": "b"})
),
)
def test_sort_dict_of_dicts(self):
self.assertEqual(
json.dumps(
{
"components": {
"schemas": {
"Bar": {"enum": ["1", "2", "4"], "type": "string"},
"Foo": {
"description": "foo",
"properties": {
"m": {"type": ["null", "string"]},
"z": {"type": "string"},
},
"type": "object",
},
}
}
}
),
json.dumps(
base.sort_data(
{
"components": {
"schemas": {
"Foo": {
"type": "object",
"description": "foo",
"properties": {
"z": {"type": "string"},
"m": {"type": ["string", "null"]},
},
},
"Bar": {
"type": "string",
"enum": ["1", "4", "2"],
},
}
}
}
)
),
)
def test_sort_spec(self):
self.assertEqual(
{
"openapi": "3.1.0",
"info": {"title": "foo"},
"components": {
"schemas": {
"Bar": {"type": "string", "enum": ["1", "2", "4"]},
"Baz": {"enum": [1, 2.3, "4", True]},
"Foo": {
"description": "foo",
"properties": {
"m": {"type": ["null", "string"]},
"z": {"type": "string"},
},
"type": "object",
},
}
},
},
base.sort_data(
{
"components": {
"schemas": {
"Foo": {
"type": "object",
"description": "foo",
"properties": {
"z": {"type": "string"},
"m": {"type": ["string", "null"]},
},
},
"Baz": {"enum": [1, 2.3, "4", True]},
"Bar": {"type": "string", "enum": ["1", "4", "2"]},
}
},
"info": {"title": "foo"},
"openapi": "3.1.0",
}
),
)
def test_order(self):
expected = OrderedDict(
{
"projects_not-tags": OrderedDict(
{
"in": "query",
"name": "not-tags",
"schema": {
"type": "string",
"x-openstack": {
"openapi": {
"schema": {
"explode": "false",
"items": {
"maxLength": 255,
"minLength": 1,
"pattern": "^[^,/]*$",
"type": "string",
},
"style": "form",
"type": "array",
}
}
},
},
}
)
}
)
unordered = {
"projects_not-tags": {
"name": "not-tags",
"in": "query",
"schema": {
"type": "string",
"x-openstack": {
"openapi": {
"schema": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 255,
"pattern": "^[^,/]*$",
},
"style": "form",
"explode": "false",
}
}
},
},
}
}
self.assertEqual(
json.dumps(expected), json.dumps(base.sort_data(unordered))
)

View File

@@ -15,7 +15,6 @@ from typing import Literal
from pydantic import BaseModel, ConfigDict, Field
OPERATION_TYPE = Literal[
"list",
"list_from_struct",
@@ -47,6 +46,7 @@ class OperationTargetParams(BaseModel):
cli_mod_path: str | None = None
operation_type: OPERATION_TYPE | None = None
# currently used for actions to find proper response body
action_name: str | None = None
operation_name: str | None = None
service_type: str | None = None
api_version: str | None = None

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,359 +1,359 @@
resources:
container-infrastructure-management.version:
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.certificate:
api_version: v1
operations:
get:
operation_id: :get
operation_type: get
create:
operation_id: certificates:post
operation_type: create
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: get
cli_full_command: certificate create
module_name: create
sdk_mod_name: create
rust-sdk:
module_name: create
show:
operation_id: certificates/certificate_id:get
operation_type: show
targets:
rust-cli:
cli_full_command: certificate show
module_name: show
sdk_mod_name: get
cli_full_command: version get
container-infrastructure-management.cluster:
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.cluster:
api_version: v1
operations:
list:
operation_id: clusters:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: cluster list
create:
operation_id: clusters:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: cluster create
module_name: create
sdk_mod_name: create
cli_full_command: cluster create
show:
operation_id: clusters/cluster_id:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: cluster show
module_name: create
delete:
operation_id: clusters/cluster_id:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
cli_full_command: cluster delete
module_name: delete
sdk_mod_name: delete
cli_full_command: cluster delete
rust-sdk:
module_name: delete
list:
operation_id: clusters:get
operation_type: list
targets:
rust-cli:
cli_full_command: cluster list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: clusters/cluster_id:get
operation_type: show
targets:
rust-cli:
cli_full_command: cluster show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: clusters/cluster_id:patch
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
cli_full_command: cluster set
module_name: set
sdk_mod_name: set
cli_full_command: cluster set
container-infrastructure-management.cluster/action/resize:
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.cluster/action/resize:
api_version: v1
operations:
create:
operation_id: clusters/actions/resize:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: cluster action resize create
module_name: create
sdk_mod_name: create
cli_full_command: cluster action resize create
container-infrastructure-management.cluster/action/upgrade:
rust-sdk:
module_name: create
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.cluster/action/upgrade:
api_version: v1
operations:
create:
operation_id: clusters/actions/upgrade:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: cluster action upgrade create
module_name: create
sdk_mod_name: create
cli_full_command: cluster action upgrade create
container-infrastructure-management.cluster/nodegroup:
rust-sdk:
module_name: create
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.cluster/nodegroup:
api_version: v1
operations:
list:
operation_id: clusters/nodegroups:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: cluster nodegroup list
create:
operation_id: clusters/nodegroups:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: cluster nodegroup create
module_name: create
sdk_mod_name: create
cli_full_command: cluster nodegroup create
delete_all:
operation_id: clusters/nodegroups:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete_all
rust-cli:
module_name: delete_all
sdk_mod_name: delete_all
find_implemented_by_sdk: true
cli_full_command: cluster nodegroup delete-all
show:
operation_id: clusters/nodegroups/nodegroup_id:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
find_implemented_by_sdk: true
cli_full_command: cluster nodegroup show
module_name: create
delete:
operation_id: clusters/nodegroups/nodegroup_id:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
cli_full_command: cluster nodegroup delete
find_implemented_by_sdk: true
module_name: delete
sdk_mod_name: delete
find_implemented_by_sdk: true
cli_full_command: cluster nodegroup delete
update:
operation_id: clusters/nodegroups/nodegroup_id:patch
operation_type: set
targets:
rust-sdk:
module_name: set
module_name: delete
delete_all:
operation_id: clusters/nodegroups:delete
operation_type: delete
targets:
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: cluster nodegroup delete-all
find_implemented_by_sdk: true
cli_full_command: cluster nodegroup set
module_name: delete_all
sdk_mod_name: delete_all
rust-sdk:
module_name: delete_all
find:
operation_id: clusters/nodegroups:get
operation_type: find
targets:
rust-sdk:
list_mod: list
module_name: find
sdk_mod_path: container_infrastructure_management::v1::cluster::nodegroup
name_field: name
name_filter_supported: false
list_mod: list
container-infrastructure-management.clustertemplate:
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
api_version: v1
operations:
show:
operation_id: clustertemplates/clustertemplate_id:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: clustertemplate show
delete:
operation_id: clustertemplates/clustertemplate_id:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: clustertemplate delete
sdk_mod_path: container_infrastructure_management::v1::cluster::nodegroup
list:
operation_id: clustertemplates:get
operation_id: clusters/nodegroups:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
cli_full_command: cluster nodegroup list
module_name: list
sdk_mod_name: list
cli_full_command: clustertemplate list
rust-sdk:
module_name: list
show:
operation_id: clusters/nodegroups/nodegroup_id:get
operation_type: show
targets:
rust-cli:
cli_full_command: cluster nodegroup show
find_implemented_by_sdk: true
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: clusters/nodegroups/nodegroup_id:patch
operation_type: set
targets:
rust-cli:
cli_full_command: cluster nodegroup set
find_implemented_by_sdk: true
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.clustertemplate:
api_version: v1
operations:
create:
operation_id: clustertemplates:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: clustertemplate create
module_name: create
sdk_mod_name: create
cli_full_command: clustertemplate create
container-infrastructure-management.quota:
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
api_version: v1
operations:
show:
operation_id: quotas/quota_id:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: quota show
module_name: create
delete:
operation_id: quotas/quota_id:delete
operation_id: clustertemplates/clustertemplate_id:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
cli_full_command: clustertemplate delete
module_name: delete
sdk_mod_name: delete
cli_full_command: quota delete
rust-sdk:
module_name: delete
list:
operation_id: quotas:get
operation_id: clustertemplates:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
cli_full_command: clustertemplate list
module_name: list
sdk_mod_name: list
cli_full_command: quota list
create:
operation_id: quotas:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
module_name: create
sdk_mod_name: create
cli_full_command: quota create
container-infrastructure-management.certificate:
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
api_version: v1
operations:
module_name: list
show:
operation_id: certificates/certificate_id:get
operation_id: clustertemplates/clustertemplate_id:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
cli_full_command: clustertemplate show
module_name: show
sdk_mod_name: get
cli_full_command: certificate show
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.federation:
api_version: v1
operations:
create:
operation_id: certificates:post
operation_id: federations:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: federation create
module_name: create
sdk_mod_name: create
cli_full_command: certificate create
container-infrastructure-management.mservice:
rust-sdk:
module_name: create
delete:
operation_id: federations/federation_id:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: federation delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: federations:get
operation_type: list
targets:
rust-cli:
cli_full_command: federation list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: federations/federation_id:get
operation_type: show
targets:
rust-cli:
cli_full_command: federation show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.mservice:
api_version: v1
operations:
list:
operation_id: mservices:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
cli_full_command: mservice list
module_name: list
sdk_mod_name: list
cli_full_command: mservice list
container-infrastructure-management.stat:
rust-sdk:
module_name: list
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.quota:
api_version: v1
operations:
create:
operation_id: quotas:post
operation_type: create
targets:
rust-cli:
cli_full_command: quota create
module_name: create
sdk_mod_name: create
rust-sdk:
module_name: create
delete:
operation_id: quotas/quota_id:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: quota delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: quotas:get
operation_type: list
targets:
rust-cli:
cli_full_command: quota list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: quotas/quota_id:get
operation_type: show
targets:
rust-cli:
cli_full_command: quota show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.stat:
api_version: v1
operations:
get:
operation_id: stats:get
operation_type: get
targets:
rust-sdk:
module_name: get
rust-cli:
cli_full_command: stat get
module_name: get
sdk_mod_name: get
cli_full_command: stat get
container-infrastructure-management.federation:
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml
container-infrastructure-management.version:
api_version: v1
operations:
show:
operation_id: federations/federation_id:get
operation_type: show
get:
operation_id: :get
operation_type: get
targets:
rust-cli:
cli_full_command: version get
module_name: get
sdk_mod_name: get
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: federation show
delete:
operation_id: federations/federation_id:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: federation delete
list:
operation_id: federations:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: federation list
create:
operation_id: federations:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
module_name: create
sdk_mod_name: create
cli_full_command: federation create
spec_file: wrk/openapi_specs/container-infrastructure-management/v1.yaml

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,157 +1,101 @@
resources:
object-store.account:
spec_file: wrk/openapi_specs/object-store/v1.yaml
api_version: v1
operations:
head:
operation_id: account.head
operation_type: action
targets:
rust-sdk:
module_name: head
#rust-cli:
# module_name: head
# sdk_mod_name: head
# cli_full_command: account show
get:
operation_id: account.get
operation_type: get
targets:
rust-sdk:
module_name: get
#rust-cli:
# module_name: get
# sdk_mod_name: get
# cli_full_command: container list
update:
operation_id: account.post
operation_type: set
targets:
rust-sdk:
module_name: set
#rust-cli:
# module_name: set
# sdk_mod_name: set
# cli_full_command: account set
delete:
operation_id: account.delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
#rust-cli:
# module_name: delete
# sdk_mod_name: delete
# cli_full_command: account delete
object-store.container:
get:
operation_id: account.get
operation_type: get
targets:
rust-sdk:
module_name: get
head:
operation_id: account.head
operation_type: action
targets:
rust-sdk:
module_name: head
update:
operation_id: account.post
operation_type: set
targets:
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/object-store/v1.yaml
object-store.container:
api_version: v1
extensions:
rust-sdk:
additional_modules:
- prune
operations:
head:
operation_id: container.head
operation_type: action
targets:
rust-sdk:
module_name: head
#rust-cli:
# module_name: head
# sdk_mod_name: head
# cli_full_command: container show
get:
operation_id: container.get
operation_type: get
targets:
rust-sdk:
module_name: get
#rust-cli:
# module_name: get
# sdk_mod_name: get
# cli_full_command: object list
create:
operation_id: container.put
operation_type: create
targets:
rust-sdk:
module_name: create
#rust-cli:
# module_name: create
# sdk_mod_name: create
# cli_full_command: container create
update:
operation_id: container.post
operation_type: set
targets:
rust-sdk:
module_name: set
#rust-cli:
# module_name: set
# sdk_mod_name: set
# cli_full_command: container set
delete:
operation_id: container.delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
#rust-cli:
# module_name: delete
# sdk_mod_name: delete
# cli_full_command: container delete
object-store.object:
spec_file: wrk/openapi_specs/object-store/v1.yaml
api_version: v1
operations:
get:
operation_id: container.get
operation_type: get
targets:
rust-sdk:
module_name: get
head:
operation_id: object.head
operation_id: container.head
operation_type: action
targets:
rust-sdk:
module_name: head
#rust-cli:
# module_name: head
# sdk_mod_name: head
# cli_full_command: object show
get:
operation_id: object.get
operation_type: download
targets:
rust-sdk:
module_name: get
#rust-cli:
# module_name: get
# sdk_mod_name: get
# cli_full_command: object download
put:
operation_id: object.put
operation_type: upload
targets:
rust-sdk:
module_name: put
#rust-cli:
# module_name: put
# sdk_mod_name: put
# cli_full_command: object upload
update:
operation_id: object.post
operation_id: container.post
operation_type: set
targets:
rust-sdk:
module_name: set
#rust-cli:
# module_name: set
# sdk_mod_name: set
# cli_full_command: object set
spec_file: wrk/openapi_specs/object-store/v1.yaml
object-store.object:
api_version: v1
operations:
delete:
operation_id: object.delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
#rust-cli:
# module_name: delete
# sdk_mod_name: delete
# cli_full_command: object delete
get:
operation_id: object.get
operation_type: download
targets:
rust-sdk:
module_name: get
head:
operation_id: object.head
operation_type: action
targets:
rust-sdk:
module_name: head
put:
operation_id: object.put
operation_type: upload
targets:
rust-sdk:
module_name: put
update:
operation_id: object.post
operation_type: set
targets:
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/object-store/v1.yaml

View File

@@ -1,413 +1,413 @@
resources:
placement.version:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
get:
operation_id: :get
operation_type: get
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: get
sdk_mod_name: get
cli_full_command: version get
placement.resource_class:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_classes:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-class list
create:
operation_id: resource_classes:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
module_name: create
sdk_mod_name: create
cli_full_command: resource-class create
show:
operation_id: resource_classes/name:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: resource-class show
update:
operation_id: resource_classes/name:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: resource-class set
delete:
operation_id: resource_classes/name:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: resource-class delete
placement.resource_provider:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_providers:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-provider list
create:
operation_id: resource_providers:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
module_name: create
sdk_mod_name: create
cli_full_command: resource-provider create
show:
operation_id: resource_providers/uuid:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: resource-provider show
update:
operation_id: resource_providers/uuid:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: resource-provider set
delete:
operation_id: resource_providers/uuid:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: resource-provider delete
placement.resource_provider/inventory:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/inventories:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-provider inventory list
replace:
operation_id: resource_providers/uuid/inventories:put
operation_type: set
targets:
rust-sdk:
module_name: replace
rust-cli:
module_name: replace
sdk_mod_name: replace
cli_full_command: resource-provider inventory replace
create:
operation_id: resource_providers/uuid/inventories:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
module_name: create
sdk_mod_name: create
cli_full_command: resource-provider inventory create
delete_all:
operation_id: resource_providers/uuid/inventories:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete_all
rust-cli:
module_name: delete_all
sdk_mod_name: delete_all
cli_full_command: resource-provider inventory purge
show:
operation_id: resource_providers/uuid/inventories/resource_class:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: resource-provider inventory show
update:
operation_id: resource_providers/uuid/inventories/resource_class:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: resource-provider inventory set
delete:
operation_id: resource_providers/uuid/inventories/resource_class:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: resource-provider inventory delete
placement.resource_provider/usage:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
get:
operation_id: resource_providers/uuid/usages:get
operation_type: get
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: get
sdk_mod_name: get
cli_full_command: resource-provider usage get
placement.resource_provider/aggregate:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/aggregates:get
operation_type: show
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-provider aggregate list
update:
operation_id: resource_providers/uuid/aggregates:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: resource-provider aggregate set
placement.resource_provider/allocation:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/allocations:get
operation_type: show
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-provider allocation list
placement.allocation:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
create:
operation_id: allocations:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: allocation create
module_name: create
sdk_mod_name: create
cli_full_command: allocation create
show:
operation_id: allocations/consumer_uuid:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: allocation show
update:
operation_id: allocations/consumer_uuid:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: allocation set
module_name: create
delete:
operation_id: allocations/consumer_uuid:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
cli_full_command: allocation delete
module_name: delete
sdk_mod_name: delete
cli_full_command: allocation delete
placement.allocation_candidate:
rust-sdk:
module_name: delete
show:
operation_id: allocations/consumer_uuid:get
operation_type: show
targets:
rust-cli:
cli_full_command: allocation show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: allocations/consumer_uuid:put
operation_type: set
targets:
rust-cli:
cli_full_command: allocation set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.allocation_candidate:
api_version: v1
operations:
list:
operation_id: allocation_candidates:get
operation_type: show
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: allocation-candidate list
placement.trait:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: traits:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: trait list
show:
operation_id: traits/name:get
operation_type: show
targets:
rust-sdk:
module_name: get
rust-cli:
module_name: show
sdk_mod_name: get
cli_full_command: trait show
update:
operation_id: traits/name:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: trait set
delete:
operation_id: traits/name:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: trait delete
placement.resource_provider/trait:
module_name: list
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/traits:get
operation_type: show
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: resource-provider trait list
update:
operation_id: resource_providers/uuid/traits:put
operation_type: set
targets:
rust-sdk:
module_name: set
rust-cli:
module_name: set
sdk_mod_name: set
cli_full_command: resource-provider trait set
delete:
operation_id: resource_providers/uuid/traits:delete
operation_type: delete
targets:
rust-sdk:
module_name: delete
rust-cli:
module_name: delete
sdk_mod_name: delete
cli_full_command: resource-provider trait delete
placement.usage:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
list:
operation_id: usages:get
operation_type: list
targets:
rust-sdk:
module_name: list
rust-cli:
module_name: list
sdk_mod_name: list
cli_full_command: usage list
placement.reshaper:
spec_file: wrk/openapi_specs/placement/v1.yaml
api_version: v1
operations:
create:
operation_id: reshaper:post
operation_type: create
targets:
rust-sdk:
module_name: create
rust-cli:
cli_full_command: reshaper create
module_name: create
sdk_mod_name: create
cli_full_command: reshaper create
rust-sdk:
module_name: create
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_class:
api_version: v1
operations:
create:
operation_id: resource_classes:post
operation_type: create
targets:
rust-cli:
cli_full_command: resource-class create
module_name: create
sdk_mod_name: create
rust-sdk:
module_name: create
delete:
operation_id: resource_classes/name:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: resource-class delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: resource_classes:get
operation_type: list
targets:
rust-cli:
cli_full_command: resource-class list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: resource_classes/name:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-class show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: resource_classes/name:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-class set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider:
api_version: v1
operations:
create:
operation_id: resource_providers:post
operation_type: create
targets:
rust-cli:
cli_full_command: resource-provider create
module_name: create
sdk_mod_name: create
rust-sdk:
module_name: create
delete:
operation_id: resource_providers/uuid:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: resource-provider delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: resource_providers:get
operation_type: list
targets:
rust-cli:
cli_full_command: resource-provider list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: resource_providers/uuid:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-provider show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: resource_providers/uuid:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-provider set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider/aggregate:
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/aggregates:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-provider aggregate list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
update:
operation_id: resource_providers/uuid/aggregates:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-provider aggregate set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider/allocation:
api_version: v1
operations:
list:
operation_id: resource_providers/uuid/allocations:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-provider allocation list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider/inventory:
api_version: v1
operations:
create:
operation_id: resource_providers/uuid/inventories:post
operation_type: create
targets:
rust-cli:
cli_full_command: resource-provider inventory create
module_name: create
sdk_mod_name: create
rust-sdk:
module_name: create
delete:
operation_id: resource_providers/uuid/inventories/resource_class:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: resource-provider inventory delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
delete_all:
operation_id: resource_providers/uuid/inventories:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: resource-provider inventory purge
module_name: delete_all
sdk_mod_name: delete_all
rust-sdk:
module_name: delete_all
list:
operation_id: resource_providers/uuid/inventories:get
operation_type: list
targets:
rust-cli:
cli_full_command: resource-provider inventory list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
replace:
operation_id: resource_providers/uuid/inventories:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-provider inventory replace
module_name: replace
sdk_mod_name: replace
rust-sdk:
module_name: replace
show:
operation_id: resource_providers/uuid/inventories/resource_class:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-provider inventory show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: resource_providers/uuid/inventories/resource_class:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-provider inventory set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider/trait:
api_version: v1
operations:
delete:
operation_id: resource_providers/uuid/traits:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: resource-provider trait delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: resource_providers/uuid/traits:get
operation_type: show
targets:
rust-cli:
cli_full_command: resource-provider trait list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
update:
operation_id: resource_providers/uuid/traits:put
operation_type: set
targets:
rust-cli:
cli_full_command: resource-provider trait set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.resource_provider/usage:
api_version: v1
operations:
get:
operation_id: resource_providers/uuid/usages:get
operation_type: get
targets:
rust-cli:
cli_full_command: resource-provider usage get
module_name: get
sdk_mod_name: get
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.trait:
api_version: v1
operations:
delete:
operation_id: traits/name:delete
operation_type: delete
targets:
rust-cli:
cli_full_command: trait delete
module_name: delete
sdk_mod_name: delete
rust-sdk:
module_name: delete
list:
operation_id: traits:get
operation_type: list
targets:
rust-cli:
cli_full_command: trait list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
show:
operation_id: traits/name:get
operation_type: show
targets:
rust-cli:
cli_full_command: trait show
module_name: show
sdk_mod_name: get
rust-sdk:
module_name: get
update:
operation_id: traits/name:put
operation_type: set
targets:
rust-cli:
cli_full_command: trait set
module_name: set
sdk_mod_name: set
rust-sdk:
module_name: set
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.usage:
api_version: v1
operations:
list:
operation_id: usages:get
operation_type: list
targets:
rust-cli:
cli_full_command: usage list
module_name: list
sdk_mod_name: list
rust-sdk:
module_name: list
spec_file: wrk/openapi_specs/placement/v1.yaml
placement.version:
api_version: v1
operations:
get:
operation_id: :get
operation_type: get
targets:
rust-cli:
cli_full_command: version get
module_name: get
sdk_mod_name: get
rust-sdk:
module_name: get
spec_file: wrk/openapi_specs/placement/v1.yaml

File diff suppressed because it is too large Load Diff