From 28ef5e73a62bee1e6096e03f2cec4842e5ac4290 Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Wed, 26 Jun 2024 12:12:07 +0200 Subject: [PATCH] docs(cli): Clarify the API command parameters in the `osc api` call first positional parameter is the service type and not the service name. Improve the helpstring and rename the parameter to underline this. --- doc/src/osc.md | 4 ++-- openstack_cli/src/api/mod.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/src/osc.md b/doc/src/osc.md index 2acb3e4b5..1996bcdb0 100644 --- a/doc/src/osc.md +++ b/doc/src/osc.md @@ -802,11 +802,11 @@ Example: ```console osc --os-cloud devstack api compute flavors/detail | jq ``` -**Usage:** `osc api [OPTIONS] ` +**Usage:** `osc api [OPTIONS] ` ###### **Arguments:** -* `` — Service name +* `` — Service type as used in the service catalog * `` — Rest URL (relative to the endpoint information from the service catalog). Do not start URL with the "/" to respect endpoint version information ###### **Options:** diff --git a/openstack_cli/src/api/mod.rs b/openstack_cli/src/api/mod.rs index 4cda60b38..073a5ea36 100644 --- a/openstack_cli/src/api/mod.rs +++ b/openstack_cli/src/api/mod.rs @@ -84,9 +84,9 @@ impl From for http::Method { /// ``` #[derive(Debug, Parser)] pub struct ApiCommand { - /// Service name + /// Service type as used in the service catalog #[arg()] - service: String, + service_type: String, /// Rest URL (relative to the endpoint information /// from the service catalog). Do not start URL with @@ -119,11 +119,11 @@ impl ApiCommand { let op = OutputProcessor::from_args(parsed_args); op.validate_args(parsed_args)?; - let service = ServiceType::from(self.service.as_str()); + let service_type = ServiceType::from(self.service_type.as_str()); - client.discover_service_endpoint(&service).await?; + client.discover_service_endpoint(&service_type).await?; - let service_endpoint = client.get_service_endpoint(&service, None)?; + let service_endpoint = client.get_service_endpoint(&service_type, None)?; let endpoint = service_endpoint.build_request_url(&self.url)?;