Skip to main content

openstack_cli_block_storage/v3/
volume_transfer.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 Transfer commands
16//!
17
18use clap::{Parser, Subcommand};
19
20use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
21use openstack_sdk::AsyncOpenStack;
22
23pub mod accept;
24pub mod create_355;
25pub mod delete;
26pub mod list;
27pub mod show;
28
29/// Volume transfers (volume-transfers) (3.55 or later)
30///
31/// Transfers a volume from one user to another user. This is the new transfer APIs with
32/// microversion 3.55.
33#[derive(Parser)]
34pub struct VolumeTransferCommand {
35    /// subcommand
36    #[command(subcommand)]
37    command: VolumeTransferCommands,
38}
39
40/// Supported subcommands
41#[allow(missing_docs)]
42#[derive(Subcommand)]
43pub enum VolumeTransferCommands {
44    Accept(Box<accept::VolumeTransferCommand>),
45    #[command(visible_alias = "create")]
46    Create355(Box<create_355::VolumeTransferCommand>),
47    Delete(Box<delete::VolumeTransferCommand>),
48    List(Box<list::VolumeTransfersCommand>),
49    Show(Box<show::VolumeTransferCommand>),
50}
51
52impl VolumeTransferCommand {
53    /// Perform command action
54    pub async fn take_action<C: CliArgs>(
55        &self,
56        parsed_args: &C,
57        session: &mut AsyncOpenStack,
58    ) -> Result<(), OpenStackCliError> {
59        match &self.command {
60            VolumeTransferCommands::Accept(cmd) => cmd.take_action(parsed_args, session).await,
61            VolumeTransferCommands::Create355(cmd) => cmd.take_action(parsed_args, session).await,
62            VolumeTransferCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
63            VolumeTransferCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
64            VolumeTransferCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
65        }
66    }
67}