openstack_cli/compute/v2/
server_group.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//! Server group
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use crate::{Cli, OpenStackCliError};
22
23pub mod create_20;
24pub mod create_215;
25pub mod create_264;
26pub mod delete;
27pub mod list;
28pub mod show;
29
30/// Server groups (os-server-groups)
31///
32/// Lists, shows information for, creates, and deletes server groups.
33#[derive(Parser)]
34pub struct ServerGroupCommand {
35    /// subcommand
36    #[command(subcommand)]
37    command: ServerGroupCommands,
38}
39
40/// Supported subcommands
41#[allow(missing_docs)]
42#[derive(Subcommand)]
43pub enum ServerGroupCommands {
44    #[command(visible_alias = "create")]
45    Create264(create_264::ServerGroupCommand),
46    Create215(create_215::ServerGroupCommand),
47    Create20(create_20::ServerGroupCommand),
48    Delete(delete::ServerGroupCommand),
49    List(list::ServerGroupsCommand),
50    Show(show::ServerGroupCommand),
51}
52
53impl ServerGroupCommand {
54    /// Perform command action
55    pub async fn take_action(
56        &self,
57        parsed_args: &Cli,
58        session: &mut AsyncOpenStack,
59    ) -> Result<(), OpenStackCliError> {
60        match &self.command {
61            ServerGroupCommands::Create264(cmd) => cmd.take_action(parsed_args, session).await,
62            ServerGroupCommands::Create215(cmd) => cmd.take_action(parsed_args, session).await,
63            ServerGroupCommands::Create20(cmd) => cmd.take_action(parsed_args, session).await,
64            ServerGroupCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
65            ServerGroupCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
66            ServerGroupCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
67        }
68    }
69}