Skip to main content

openstack_cli_network/v2/
network_segment_range.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//! NetworkSegmentRange commands
16
17use clap::{Parser, Subcommand};
18
19use openstack_cli_core::{cli::CliArgs, error::OpenStackCliError};
20use openstack_sdk::AsyncOpenStack;
21
22pub mod create;
23pub mod delete;
24pub mod list;
25pub mod set;
26pub mod show;
27pub mod tag;
28
29/// Network Segment Ranges
30///
31/// The network segment range extension exposes the segment range management to be administered via
32/// the Neutron API. It introduces the network-segment-range resource for tenant network segment
33/// allocation. In addition, it introduces the ability for the administrator to control the segment
34/// ranges globally or on a per-tenant basis.
35///
36/// Lists, shows details for, creates, updates, and deletes network segment ranges. The network
37/// segment ranges API is admin-only.
38#[derive(Parser)]
39pub struct NetworkSegmentRangeCommand {
40    /// subcommand
41    #[command(subcommand)]
42    command: NetworkSegmentRangeCommands,
43}
44
45/// Supported subcommands
46#[allow(missing_docs)]
47#[derive(Subcommand)]
48pub enum NetworkSegmentRangeCommands {
49    Create(Box<create::NetworkSegmentRangeCommand>),
50    Delete(Box<delete::NetworkSegmentRangeCommand>),
51    List(Box<list::NetworkSegmentRangesCommand>),
52    Set(Box<set::NetworkSegmentRangeCommand>),
53    Show(Box<show::NetworkSegmentRangeCommand>),
54    Tag(Box<tag::TagCommand>),
55}
56
57impl NetworkSegmentRangeCommand {
58    /// Perform command action
59    pub async fn take_action<C: CliArgs>(
60        &self,
61        parsed_args: &C,
62        session: &mut AsyncOpenStack,
63    ) -> Result<(), OpenStackCliError> {
64        match &self.command {
65            NetworkSegmentRangeCommands::Create(cmd) => cmd.take_action(parsed_args, session).await,
66            NetworkSegmentRangeCommands::Delete(cmd) => cmd.take_action(parsed_args, session).await,
67            NetworkSegmentRangeCommands::List(cmd) => cmd.take_action(parsed_args, session).await,
68            NetworkSegmentRangeCommands::Set(cmd) => cmd.take_action(parsed_args, session).await,
69            NetworkSegmentRangeCommands::Show(cmd) => cmd.take_action(parsed_args, session).await,
70            NetworkSegmentRangeCommands::Tag(cmd) => cmd.take_action(parsed_args, session).await,
71        }
72    }
73}