Skip to main content

openstack_cli_block_storage/v3/
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//! Block storage Volume Group commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
20use openstack_sdk::AsyncOpenStack;
21
22pub mod create_313;
23pub mod create_from_src_314;
24pub mod delete_313;
25pub mod disable_replication_338;
26pub mod enable_replication_338;
27pub mod failover_replication_338;
28pub mod list;
29pub mod list_replication_targets_338;
30pub mod reset_status_320;
31pub mod set_313;
32pub mod show;
33
34/// Generic volume groups (groups)
35///
36/// Generic volume groups enable you to create a group of volumes and manage them together.
37///
38/// How is generic volume groups different from consistency groups? Currently consistency groups in
39/// cinder only support consistent group snapshot. It cannot be extended easily to serve other
40/// purposes. A project may want to put volumes used in the same application together in a group so
41/// that it is easier to manage them together, and this group of volumes may or may not support
42/// consistent group snapshot. Generic volume group is introduced to solve this problem. By
43/// decoupling the tight relationship between the group construct and the consistency concept,
44/// generic volume groups can be extended to support other features in the future.
45#[derive(Parser)]
46pub struct GroupCommand {
47    /// subcommand
48    #[command(subcommand)]
49    command: GroupCommands,
50}
51
52/// Supported subcommands
53#[allow(missing_docs)]
54#[derive(Subcommand)]
55pub enum GroupCommands {
56    #[command(visible_alias = "create")]
57    Create313(Box<create_313::GroupCommand>),
58    #[command(visible_alias = "create_from_src")]
59    CreateFromSrc314(Box<create_from_src_314::GroupCommand>),
60    #[command(visible_alias = "delete")]
61    Delete313(Box<delete_313::GroupCommand>),
62    #[command(visible_alias = "disable-replication")]
63    DisableReplication338(Box<disable_replication_338::GroupCommand>),
64    #[command(visible_alias = "enable-replication")]
65    EnableReplication338(Box<enable_replication_338::GroupCommand>),
66    #[command(visible_alias = "failover-replication")]
67    FailoverReplication338(Box<failover_replication_338::GroupCommand>),
68    List(Box<list::GroupsCommand>),
69    #[command(visible_alias = "list-replication-targets")]
70    ListReplicationTargets338(Box<list_replication_targets_338::GroupCommand>),
71    #[command(visible_alias = "reset-status")]
72    ResetStatus320(Box<reset_status_320::GroupCommand>),
73    Set313(Box<set_313::GroupCommand>),
74    Show(Box<show::GroupCommand>),
75}
76
77impl GroupCommand {
78    /// Perform command action
79    pub async fn take_action<C: CliArgs>(
80        &self,
81        parsed_args: &C,
82        session: &mut AsyncOpenStack,
83    ) -> Result<(), OpenStackCliError> {
84        match &self.command {
85            GroupCommands::Create313(cmd) => cmd.take_action(parsed_args, session).await,
86            GroupCommands::CreateFromSrc314(cmd) => cmd.take_action(parsed_args, session).await,
87            GroupCommands::Delete313(cmd) => cmd.take_action(parsed_args, session).await,
88            GroupCommands::DisableReplication338(cmd) => {
89                cmd.take_action(parsed_args, session).await
90            }
91            GroupCommands::EnableReplication338(cmd) => cmd.take_action(parsed_args, session).await,
92            GroupCommands::FailoverReplication338(cmd) => {
93                cmd.take_action(parsed_args, session).await
94            }
95            GroupCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
96            GroupCommands::ListReplicationTargets338(cmd) => {
97                cmd.take_action(parsed_args, session).await
98            }
99            GroupCommands::ResetStatus320(cmd) => cmd.take_action(parsed_args, session).await,
100            GroupCommands::Set313(cmd) => cmd.take_action(parsed_args, session).await,
101            GroupCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
102        }
103    }
104}