Skip to main content

openstack_cli_block_storage/v3/group/
disable_replication_338.rs

1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5//     http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12//
13// SPDX-License-Identifier: Apache-2.0
14//
15// WARNING: This file is automatically generated from OpenAPI schema using
16// `openstack-codegenerator`.
17
18//! Action Group command [microversion = 3.38]
19//!
20//! Wraps invoking of the `v3/groups/action` with `POST` method
21
22use clap::Args;
23use tracing::info;
24
25use openstack_cli_core::cli::CliArgs;
26use openstack_cli_core::error::OpenStackCliError;
27use openstack_cli_core::output::OutputProcessor;
28use openstack_sdk::AsyncOpenStack;
29
30use openstack_cli_core::common::parse_key_val;
31use openstack_sdk::api::QueryAsync;
32use openstack_sdk::api::block_storage::v3::group::disable_replication_338;
33use serde_json::Value;
34
35/// Command without description in OpenAPI
36#[derive(Args)]
37pub struct GroupCommand {
38    /// Request Query parameters
39    #[command(flatten)]
40    query: QueryParameters,
41
42    /// Path parameters
43    #[command(flatten)]
44    path: PathParameters,
45
46    #[arg(help_heading = "Body parameters", long, value_name="key=value", value_parser=parse_key_val::<String, Value>)]
47    disable_replication: Vec<(String, Value)>,
48}
49
50/// Query parameters
51#[derive(Args)]
52struct QueryParameters {}
53
54/// Path parameters
55#[derive(Args)]
56struct PathParameters {}
57
58impl GroupCommand {
59    /// Perform command action
60    pub async fn take_action<C: CliArgs>(
61        &self,
62        parsed_args: &C,
63        client: &mut AsyncOpenStack,
64    ) -> Result<(), OpenStackCliError> {
65        info!("Action Group");
66
67        let op = OutputProcessor::from_args(
68            parsed_args,
69            Some("block-storage.group"),
70            Some("disable_replication"),
71        );
72        op.validate_args(parsed_args)?;
73
74        let mut ep_builder = disable_replication_338::Request::builder();
75        ep_builder.header(
76            http::header::HeaderName::from_static("openstack-api-version"),
77            http::header::HeaderValue::from_static("volume 3.38"),
78        );
79
80        // Set body parameters
81        // Set Request.disable_replication data
82
83        ep_builder.disable_replication(self.disable_replication.iter().cloned());
84
85        let ep = ep_builder
86            .build()
87            .map_err(|x| OpenStackCliError::EndpointBuild(x.to_string()))?;
88        openstack_sdk::api::ignore(ep).query_async(client).await?;
89        // Show command specific hints
90        op.show_command_hint()?;
91        Ok(())
92    }
93}