Skip to main content

openstack_cli_compute/v2/flavor/
extra_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//! Compute Flavor Extra Specs commands
16use clap::{Parser, Subcommand};
17
18use openstack_sdk::AsyncOpenStack;
19
20use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
21
22mod create;
23mod delete;
24mod list;
25mod set;
26mod show;
27
28/// Flavor extra specs
29#[derive(Parser)]
30pub struct ExtraSpecsCommand {
31    /// subcommand
32    #[command(subcommand)]
33    command: ExtraSpecsCommands,
34}
35
36/// Supported subcommands
37#[allow(missing_docs)]
38#[derive(Subcommand)]
39pub enum ExtraSpecsCommands {
40    /// Creates extra specs for a flavor, by ID.
41    #[command(about = "Create Extra Specs For A Flavor")]
42    Create(create::ExtraSpecCommand),
43    /// Deletes an extra spec, by key, for a flavor, by ID.
44    #[command(about = "Delete An Extra Spec For A Flavor")]
45    Delete(delete::ExtraSpecCommand),
46    /// Lists all extra specs for a flavor, by ID.
47    #[command(about = "List Extra Specs For A Flavor")]
48    List(list::ExtraSpecsCommand),
49    /// Shows an extra spec, by key, for a flavor, by ID.
50    #[command(about = "Show An Extra Spec For A Flavor")]
51    Show(show::ExtraSpecCommand),
52    /// Updates an extra spec, by key, for a flavor, by ID.
53    #[command(about = "Update An Extra Spec For A Flavor
54")]
55    Set(set::ExtraSpecCommand),
56}
57
58impl ExtraSpecsCommand {
59    /// Perform command action
60    pub async fn take_action<C: CliArgs>(
61        &self,
62        parsed_args: &C,
63        session: &mut AsyncOpenStack,
64    ) -> Result<(), OpenStackCliError> {
65        match &self.command {
66            ExtraSpecsCommands::Create(cmd) => cmd.take_action(parsed_args, session).await,
67            ExtraSpecsCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
68            ExtraSpecsCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
69            ExtraSpecsCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
70            ExtraSpecsCommands::Set(cmd) => cmd.take_action(parsed_args, session).await,
71        }
72    }
73}