Skip to main content

openstack_cli_compute/v2/
quota_set.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//! Quota Set
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
22
23pub mod defaults;
24pub mod delete;
25pub mod details;
26pub mod set_236;
27pub mod set_257;
28pub mod show;
29
30/// Quota sets (os-quota-sets)
31///
32/// Permits administrators, depending on policy settings, to view default quotas, view details for
33/// quotas, revert quotas to defaults, and update the quotas for a project or a project and user.
34#[derive(Parser)]
35pub struct QuotaSetCommand {
36    /// subcommand
37    #[command(subcommand)]
38    command: QuotaSetCommands,
39}
40
41/// Supported subcommands
42#[allow(missing_docs)]
43#[derive(Subcommand)]
44pub enum QuotaSetCommands {
45    Defaults(defaults::QuotaSetCommand),
46    Delete(delete::QuotaSetCommand),
47    Details(details::QuotaSetCommand),
48    #[command(visible_alias = "set")]
49    Set257(set_257::QuotaSetCommand),
50    Set236(set_236::QuotaSetCommand),
51    Show(show::QuotaSetCommand),
52}
53
54impl QuotaSetCommand {
55    /// Perform command action
56    pub async fn take_action<C: CliArgs>(
57        &self,
58        parsed_args: &C,
59        session: &mut AsyncOpenStack,
60    ) -> Result<(), OpenStackCliError> {
61        match &self.command {
62            QuotaSetCommands::Defaults(cmd) => cmd.take_action(parsed_args, session).await,
63            QuotaSetCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
64            QuotaSetCommands::Details(cmd) => cmd.take_action(parsed_args, session).await,
65            QuotaSetCommands::Set257(cmd) => cmd.take_action(parsed_args, session).await,
66            QuotaSetCommands::Set236(cmd) => cmd.take_action(parsed_args, session).await,
67            QuotaSetCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
68        }
69    }
70}