Skip to main content

openstack_cli_block_storage/v3/
backup.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 Backup commands
16//!
17
18use clap::{Parser, Subcommand};
19
20use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
21use openstack_sdk::AsyncOpenStack;
22
23pub mod create_30;
24pub mod create_343;
25pub mod create_351;
26pub mod delete;
27/// Export backup record
28pub mod export_record {
29    pub mod get;
30}
31pub mod list;
32/// Import backup records
33pub mod import_record {
34    pub mod create;
35}
36pub mod os_force_delete;
37pub mod os_reset_status;
38pub mod set_343;
39pub mod set_39;
40pub mod show;
41
42/// Backups
43///
44/// A backup is a full copy of a volume stored in an external service. The service can be
45/// configured. The only supported service is Object Storage. A backup can subsequently be restored
46/// from the external service to either the same volume that the backup was originally taken from
47/// or to a new volume.
48#[derive(Parser)]
49pub struct BackupCommand {
50    /// subcommand
51    #[command(subcommand)]
52    command: BackupCommands,
53}
54
55/// Supported subcommands
56#[allow(missing_docs)]
57#[derive(Subcommand)]
58pub enum BackupCommands {
59    #[command(visible_alias = "create")]
60    Create351(Box<create_351::BackupCommand>),
61    Create343(Box<create_343::BackupCommand>),
62    Create30(Box<create_30::BackupCommand>),
63    Delete(Box<delete::BackupCommand>),
64    Export(Box<export_record::get::ExportRecordCommand>),
65    ForceDelete(Box<os_force_delete::BackupCommand>),
66    Import(Box<import_record::create::ImportRecordCommand>),
67    List(Box<list::BackupsCommand>),
68    ResetStatus(Box<os_reset_status::BackupCommand>),
69    #[command(visible_alias = "set")]
70    Set343(Box<set_343::BackupCommand>),
71    Set39(Box<set_39::BackupCommand>),
72    Show(Box<show::BackupCommand>),
73}
74
75impl BackupCommand {
76    /// Perform command action
77    pub async fn take_action<C: CliArgs>(
78        &self,
79        parsed_args: &C,
80        session: &mut AsyncOpenStack,
81    ) -> Result<(), OpenStackCliError> {
82        match &self.command {
83            BackupCommands::Create351(cmd) => cmd.take_action(parsed_args, session).await,
84            BackupCommands::Create343(cmd) => cmd.take_action(parsed_args, session).await,
85            BackupCommands::Create30(cmd) => cmd.take_action(parsed_args, session).await,
86            BackupCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
87            BackupCommands::Export(cmd) => cmd.take_action(parsed_args, session).await,
88            BackupCommands::ForceDelete(cmd) => cmd.take_action(parsed_args, session).await,
89            BackupCommands::Import(cmd) => cmd.take_action(parsed_args, session).await,
90            BackupCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
91            BackupCommands::ResetStatus(cmd) => cmd.take_action(parsed_args, session).await,
92            BackupCommands::Set343(cmd) => cmd.take_action(parsed_args, session).await,
93            BackupCommands::Set39(cmd) => cmd.take_action(parsed_args, session).await,
94            BackupCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
95        }
96    }
97}