Skip to main content

openstack_cli_block_storage/v3/
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//! Block storage Volume `quota-set` commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
20use openstack_sdk::AsyncOpenStack;
21
22pub mod defaults;
23pub mod delete;
24pub mod set;
25pub mod show;
26
27/// Quota sets extension (os-quota-sets)
28///
29/// Administrators only, depending on policy settings.
30///
31/// Shows, updates, and deletes quotas for a project.
32#[derive(Parser)]
33pub struct QuotaSetCommand {
34    /// subcommand
35    #[command(subcommand)]
36    command: QuotaSetCommands,
37}
38
39/// Supported subcommands
40#[allow(missing_docs)]
41#[derive(Subcommand)]
42pub enum QuotaSetCommands {
43    /// Gets default quotas for a project.
44    ///
45    /// Gets default quotas for a project.
46    Defaults(Box<defaults::QuotaSetCommand>),
47    /// Delete quotas for a project
48    ///
49    /// Deletes quotas for a project so the quotas revert to default values.
50    Delete(Box<delete::QuotaSetCommand>),
51    /// Update quotas for a project.
52    ///
53    /// Update quotas for a project.
54    Set(Box<set::QuotaSetCommand>),
55    /// Show quota usage for a project.
56    ///
57    /// Show quota usage for a project.
58    Show(Box<show::QuotaSetCommand>),
59}
60
61impl QuotaSetCommand {
62    /// Perform command action
63    pub async fn take_action<C: CliArgs>(
64        &self,
65        parsed_args: &C,
66        session: &mut AsyncOpenStack,
67    ) -> Result<(), OpenStackCliError> {
68        match &self.command {
69            QuotaSetCommands::Defaults(cmd) => cmd.take_action(parsed_args, session).await,
70            QuotaSetCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
71            QuotaSetCommands::Set(cmd) => cmd.take_action(parsed_args, session).await,
72            QuotaSetCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
73        }
74    }
75}