Skip to main content

openstack_cli_block_storage/v3/
qos_spec.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//! Block storage Volume QOS-SPEC commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
20use openstack_sdk::AsyncOpenStack;
21
22pub mod associate;
23pub mod association;
24pub mod create;
25pub mod delete;
26pub mod delete_keys;
27pub mod disassociate;
28pub mod disassociate_all;
29pub mod list;
30pub mod set;
31pub mod show;
32
33/// Quality of service (QoS) specifications (qos-specs)
34///
35/// Administrators only, depending on policy settings.
36///
37/// Creates, lists, shows details for, associates, disassociates, sets keys, unsets keys, and
38/// deletes quality of service (QoS) specifications.
39#[derive(Parser)]
40pub struct QosSpecCommand {
41    /// subcommand
42    #[command(subcommand)]
43    command: QosSpecCommands,
44}
45
46/// Supported subcommands
47#[allow(missing_docs)]
48#[derive(Subcommand)]
49pub enum QosSpecCommands {
50    Association(Box<association::AssociationCommand>),
51    Associate(Box<associate::QosSpecCommand>),
52    Create(Box<create::QosSpecCommand>),
53    Delete(Box<delete::QosSpecCommand>),
54    DeleteKeys(Box<delete_keys::QosSpecCommand>),
55    Disassociate(Box<disassociate::QosSpecCommand>),
56    DisassociateAll(Box<disassociate_all::QosSpecCommand>),
57    List(Box<list::QosSpecsCommand>),
58    Set(Box<set::QosSpecCommand>),
59    Show(Box<show::QosSpecCommand>),
60}
61
62impl QosSpecCommand {
63    /// Perform command action
64    pub async fn take_action<C: CliArgs>(
65        &self,
66        parsed_args: &C,
67        session: &mut AsyncOpenStack,
68    ) -> Result<(), OpenStackCliError> {
69        match &self.command {
70            QosSpecCommands::Association(cmd) => cmd.take_action(parsed_args, session).await,
71            QosSpecCommands::Associate(cmd) => cmd.take_action(parsed_args, session).await,
72            QosSpecCommands::Create(cmd) => cmd.take_action(parsed_args, session).await,
73            QosSpecCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
74            QosSpecCommands::DeleteKeys(cmd) => cmd.take_action(parsed_args, session).await,
75            QosSpecCommands::Disassociate(cmd) => cmd.take_action(parsed_args, session).await,
76            QosSpecCommands::DisassociateAll(cmd) => cmd.take_action(parsed_args, session).await,
77            QosSpecCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
78            QosSpecCommands::Set(cmd) => cmd.take_action(parsed_args, session).await,
79            QosSpecCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
80        }
81    }
82}