Drop anyhow in cli templates
- drop anyhow in favor of eyre crate - fix few things in nova changed in the meanwhile Change-Id: I919cac5bf92e5279a4d840ddf0196e6daa74d869
This commit is contained in:
parent
97a82290cd
commit
600d7aca5a
codegenerator
metadata
@ -832,6 +832,9 @@ class OpenStackServerSourceBase:
|
||||
|
||||
It is expected, that this method is invoked in the raising min_ver order to do proper cleanup of max_ver
|
||||
"""
|
||||
if "type" not in obj:
|
||||
# Nova has empty definitions for deprecated methods
|
||||
return
|
||||
# Yey - we have query_parameters
|
||||
if obj["type"] == "object":
|
||||
params = obj["properties"]
|
||||
@ -839,7 +842,10 @@ class OpenStackServerSourceBase:
|
||||
param_name = "_".join(path_resource_names) + f"_{prop}"
|
||||
|
||||
param_attrs: dict[str, TypeSchema | dict] = {}
|
||||
if spec["type"] == "array":
|
||||
if spec == {}:
|
||||
# Nova added empty params since it was never validating them. Skip
|
||||
param_attrs["schema"] = TypeSchema(type="string")
|
||||
elif spec["type"] == "array":
|
||||
param_attrs["schema"] = TypeSchema(
|
||||
**copy.deepcopy(spec["items"])
|
||||
)
|
||||
|
@ -110,7 +110,7 @@ class JsonValue(common_rust.JsonValue):
|
||||
if self.original_data_type and isinstance(
|
||||
self.original_data_type, common_rust.Dictionary
|
||||
):
|
||||
imports.update(["std::collections::BTreeMap", "anyhow::Context"])
|
||||
imports.update(["std::collections::BTreeMap", "eyre::WrapErr"])
|
||||
return imports
|
||||
|
||||
|
||||
|
@ -25,8 +25,6 @@ use clap::Args;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tracing::info;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use openstack_sdk::AsyncOpenStack;
|
||||
|
||||
use crate::output::OutputProcessor;
|
||||
|
@ -169,7 +169,7 @@ Some({{ val }})
|
||||
{%- elif original_type and original_type.__class__.__name__ == "DictionaryInput" and original_type.value_type and original_type.value_type.__class__.__name__ == "DictionaryInput" %}
|
||||
{{ dst_var }}.{{ param.remote_name }}(
|
||||
serde_json::from_value::<BTreeMap<String, BTreeMap<String, {{ original_type.value_type.value_type.type_hint }}>>>({{ val_var | replace("&", "") }}.clone())
|
||||
.with_context(|| "Failed to parse `{{ param.local_name }}` as dict of dicts of {{ original_type.value_type.value_type.type_hint }}")?
|
||||
.wrap_err_with(|| "Failed to parse `{{ param.local_name }}` as dict of dicts of {{ original_type.value_type.value_type.type_hint }}")?
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, v.into_iter())),
|
||||
);
|
||||
|
@ -324,11 +324,31 @@ resources:
|
||||
api_version: v3
|
||||
operations:
|
||||
check:
|
||||
operation_id: credentials:head
|
||||
operation_id: credentials/credential_id:head
|
||||
operation_type: get
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: head
|
||||
list:
|
||||
operation_id: credentials:get
|
||||
operation_type: list
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: list
|
||||
rust-cli:
|
||||
module_name: list
|
||||
sdk_mod_name: list
|
||||
cli_full_command: credential list
|
||||
create:
|
||||
operation_id: credentials:post
|
||||
operation_type: create
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: create
|
||||
rust-cli:
|
||||
module_name: create
|
||||
sdk_mod_name: create
|
||||
cli_full_command: credential create
|
||||
show:
|
||||
operation_id: credentials/credential_id:get
|
||||
operation_type: show
|
||||
@ -359,26 +379,6 @@ resources:
|
||||
module_name: set
|
||||
sdk_mod_name: set
|
||||
cli_full_command: credential set
|
||||
list:
|
||||
operation_id: credentials:get
|
||||
operation_type: list
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: list
|
||||
rust-cli:
|
||||
module_name: list
|
||||
sdk_mod_name: list
|
||||
cli_full_command: credential list
|
||||
create:
|
||||
operation_id: credentials:post
|
||||
operation_type: create
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: create
|
||||
rust-cli:
|
||||
module_name: create
|
||||
sdk_mod_name: create
|
||||
cli_full_command: credential create
|
||||
identity.domain:
|
||||
spec_file: wrk/openapi_specs/identity/v3.yaml
|
||||
api_version: v3
|
||||
@ -3110,6 +3110,56 @@ resources:
|
||||
module_name: list
|
||||
sdk_mod_name: list
|
||||
cli_full_command: user projects
|
||||
identity.user/credential/OS_EC2:
|
||||
spec_file: wrk/openapi_specs/identity/v3.yaml
|
||||
api_version: v3
|
||||
operations:
|
||||
check:
|
||||
operation_id: users/user_id/credentials/OS-EC2/credential_id:head
|
||||
operation_type: get
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: head
|
||||
list:
|
||||
operation_id: users/user_id/credentials/OS-EC2:get
|
||||
operation_type: list
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: list
|
||||
rust-cli:
|
||||
module_name: list
|
||||
sdk_mod_name: list
|
||||
cli_full_command: user credential OS-EC2 list
|
||||
create:
|
||||
operation_id: users/user_id/credentials/OS-EC2:post
|
||||
operation_type: create
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: create
|
||||
rust-cli:
|
||||
module_name: create
|
||||
sdk_mod_name: create
|
||||
cli_full_command: user credential OS-EC2 create
|
||||
show:
|
||||
operation_id: users/user_id/credentials/OS-EC2/credential_id:get
|
||||
operation_type: show
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: get
|
||||
rust-cli:
|
||||
module_name: show
|
||||
sdk_mod_name: get
|
||||
cli_full_command: user credential OS-EC2 show
|
||||
delete:
|
||||
operation_id: users/user_id/credentials/OS-EC2/credential_id:delete
|
||||
operation_type: delete
|
||||
targets:
|
||||
rust-sdk:
|
||||
module_name: delete
|
||||
rust-cli:
|
||||
module_name: delete
|
||||
sdk_mod_name: delete
|
||||
cli_full_command: user credential OS-EC2 delete
|
||||
identity.user/OS_OAUTH1/access_token:
|
||||
spec_file: wrk/openapi_specs/identity/v3.yaml
|
||||
api_version: v3
|
||||
|
Loading…
x
Reference in New Issue
Block a user