Skip to main content

openstack_cli_network/v2/qos/
alias_bandwidth_limit_rule.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//! Bandwitch Limit rul commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
22
23pub mod create;
24pub mod delete;
25pub mod list;
26pub mod set;
27pub mod show;
28
29/// Quality of Service rules alias API
30///
31/// The purpose of this API extension is to enable callers to execute the requests to delete, show
32/// and update QoS rules without specifying the corresponding policy ID. Otherwise, these requests
33/// have the exact same behavior as their counterparts described in other parts of this
34/// documentation. The requests available in this API extension are:
35#[derive(Parser)]
36pub struct AliasBandwidthLimitRuleCommand {
37    /// subcommand
38    #[command(subcommand)]
39    command: AliasBandwidthLimitRuleCommands,
40}
41
42/// Supported subcommands
43#[allow(missing_docs)]
44#[derive(Subcommand)]
45pub enum AliasBandwidthLimitRuleCommands {
46    Create(Box<create::AliasBandwidthLimitRuleCommand>),
47    Delete(delete::AliasBandwidthLimitRuleCommand),
48    List(Box<list::AliasBandwidthLimitRulesCommand>),
49    Set(Box<set::AliasBandwidthLimitRuleCommand>),
50    Show(Box<show::AliasBandwidthLimitRuleCommand>),
51}
52
53impl AliasBandwidthLimitRuleCommand {
54    /// Perform command action
55    pub async fn take_action<C: CliArgs>(
56        &self,
57        parsed_args: &C,
58        session: &mut AsyncOpenStack,
59    ) -> Result<(), OpenStackCliError> {
60        match &self.command {
61            AliasBandwidthLimitRuleCommands::Create(cmd) => {
62                cmd.take_action(parsed_args, session).await
63            }
64            AliasBandwidthLimitRuleCommands::Delete(cmd) => {
65                cmd.take_action(parsed_args, session).await
66            }
67            AliasBandwidthLimitRuleCommands::List(cmd) => {
68                cmd.take_action(parsed_args, session).await
69            }
70            AliasBandwidthLimitRuleCommands::Set(cmd) => {
71                cmd.take_action(parsed_args, session).await
72            }
73            AliasBandwidthLimitRuleCommands::Show(cmd) => {
74                cmd.take_action(parsed_args, session).await
75            }
76        }
77    }
78}