Files
codegenerator/codegenerator/templates/rust_cli/headers_parameters.j2
Artem Goncharov ae4937df75 Set header parameters in the cli
Certain API operations support/require additional header parameters to
be set with the query (i.e. DNS supports `x-auth-all-projects` and
`x-auth-sudo-project-id`). Such supported headers should be known from
the OpenAPI spec, so add them in the CLI operation and correspondingly
set them into the query.

In difference to the `python-designateclient` `x-auth-all-projects` will
not be set by default, it is wrong to assume so. Admin user is expected
to set this parameter in the CLI invocation explicitly.

Change-Id: I49b9c31dc47911e261cbdd880c3e6d7327e50f4b
Signed-off-by: Artem Goncharov <artem.goncharov@gmail.com>
2025-07-24 15:56:19 +02:00

16 lines
425 B
Django/Jinja

{%- if type_manager.get_parameters("header") | list | length > 0 %}
/// Header parameters
#[derive(Args)]
struct HeaderParameters {
{%- for name, param in type_manager.parameters | dictsort %}
{%- if param.location == "header" %}
{{ macros.docstring(param.description_with_defaults(), indent=4) }}
{{ param.clap_macros }}
{{ param.local_name}}: {{ param.type_hint }},
{%- endif %}
{%- endfor %}
}
{%- endif %}