openstack_cli_compute/v2/availability_zone.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//! Availability zone management
16
17use clap::{Parser, Subcommand};
18
19use openstack_sdk::AsyncOpenStack;
20
21use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
22
23pub mod list;
24pub mod list_detail;
25
26/// Availability zones
27///
28/// Lists and gets detailed availability zone information.
29///
30/// An availability zone is created or updated by setting the
31/// availability_zone parameter in the create, update, or create or update
32/// methods of the Host Aggregates API. See Host Aggregates for more details.
33#[derive(Parser)]
34pub struct AvailabilityZoneCommand {
35 /// subcommand
36 #[command(subcommand)]
37 command: AvailabilityZoneCommands,
38}
39
40/// Supported subcommands
41#[allow(missing_docs)]
42#[derive(Subcommand)]
43pub enum AvailabilityZoneCommands {
44 List(list::AvailabilityZonesCommand),
45 ListDetail(list_detail::AvailabilityZonesCommand),
46}
47
48impl AvailabilityZoneCommand {
49 /// Perform command action
50 pub async fn take_action<C: CliArgs>(
51 &self,
52 parsed_args: &C,
53 session: &mut AsyncOpenStack,
54 ) -> Result<(), OpenStackCliError> {
55 match &self.command {
56 AvailabilityZoneCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
57 AvailabilityZoneCommands::ListDetail(cmd) => {
58 cmd.take_action(parsed_args, session).await
59 }
60 }
61 }
62}