diff --git a/openstack_cli/src/network/v2.rs b/openstack_cli/src/network/v2.rs index f56e81b2f..95c5985b7 100644 --- a/openstack_cli/src/network/v2.rs +++ b/openstack_cli/src/network/v2.rs @@ -23,6 +23,7 @@ use crate::{Cli, OpenStackCliError}; mod address_group; mod address_scope; mod agent; +mod auto_allocated_topology; mod availability_zone; mod extension; mod floatingip; @@ -50,6 +51,7 @@ pub enum NetworkCommands { AddressGroup(Box), AddressScope(Box), Agent(Box), + AutoAllocatedTopology(Box), AvailabilityZone(Box), Extension(Box), FloatingIP(Box), @@ -79,6 +81,9 @@ impl NetworkCommand { NetworkCommands::AddressGroup(cmd) => cmd.take_action(parsed_args, session).await, NetworkCommands::AddressScope(cmd) => cmd.take_action(parsed_args, session).await, NetworkCommands::Agent(cmd) => cmd.take_action(parsed_args, session).await, + NetworkCommands::AutoAllocatedTopology(cmd) => { + cmd.take_action(parsed_args, session).await + } NetworkCommands::AvailabilityZone(cmd) => cmd.take_action(parsed_args, session).await, NetworkCommands::Extension(cmd) => cmd.take_action(parsed_args, session).await, NetworkCommands::FloatingIP(cmd) => cmd.take_action(parsed_args, session).await, diff --git a/openstack_cli/src/network/v2/auto_allocated_topology.rs b/openstack_cli/src/network/v2/auto_allocated_topology.rs new file mode 100644 index 000000000..cdf063ff5 --- /dev/null +++ b/openstack_cli/src/network/v2/auto_allocated_topology.rs @@ -0,0 +1,70 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +//! AutoAllocatedTopology resource commands + +use clap::{Parser, Subcommand}; + +use openstack_sdk::AsyncOpenStack; + +use crate::{Cli, OpenStackCliError}; + +mod create; +mod delete; +mod list; +mod set; +mod show; + +/// Auto Allocated Topologies +/// +/// Show details and delete the auto allocated topology for a given project. This API is only +/// available when the auto-allocated-topology extension is enabled. +#[derive(Parser)] +pub struct AutoAllocatedTopologyCommand { + /// subcommand + #[command(subcommand)] + command: AutoAllocatedTopologyCommands, +} + +/// Supported subcommands +#[allow(missing_docs)] +#[derive(Subcommand)] +pub enum AutoAllocatedTopologyCommands { + Create(Box), + Delete(Box), + List(Box), + Set(Box), + Show(Box), +} + +impl AutoAllocatedTopologyCommand { + /// Perform command action + pub async fn take_action( + &self, + parsed_args: &Cli, + session: &mut AsyncOpenStack, + ) -> Result<(), OpenStackCliError> { + match &self.command { + AutoAllocatedTopologyCommands::Create(cmd) => { + cmd.take_action(parsed_args, session).await + } + AutoAllocatedTopologyCommands::Delete(cmd) => { + cmd.take_action(parsed_args, session).await + } + AutoAllocatedTopologyCommands::List(cmd) => cmd.take_action(parsed_args, session).await, + AutoAllocatedTopologyCommands::Set(cmd) => cmd.take_action(parsed_args, session).await, + AutoAllocatedTopologyCommands::Show(cmd) => cmd.take_action(parsed_args, session).await, + } + } +} diff --git a/openstack_cli/src/network/v2/auto_allocated_topology/create.rs b/openstack_cli/src/network/v2/auto_allocated_topology/create.rs index 17397db33..41f07378b 100644 --- a/openstack_cli/src/network/v2/auto_allocated_topology/create.rs +++ b/openstack_cli/src/network/v2/auto_allocated_topology/create.rs @@ -31,7 +31,6 @@ use crate::OpenStackCliError; use crate::OutputConfig; use crate::StructTable; -use crate::common::parse_json; use crate::common::parse_key_val; use openstack_sdk::api::network::v2::auto_allocated_topology::create; use openstack_sdk::api::QueryAsync; diff --git a/openstack_cli/src/network/v2/auto_allocated_topology/set.rs b/openstack_cli/src/network/v2/auto_allocated_topology/set.rs index d2b9227a5..eea2fd567 100644 --- a/openstack_cli/src/network/v2/auto_allocated_topology/set.rs +++ b/openstack_cli/src/network/v2/auto_allocated_topology/set.rs @@ -31,7 +31,6 @@ use crate::OpenStackCliError; use crate::OutputConfig; use crate::StructTable; -use crate::common::parse_json; use crate::common::parse_key_val; use openstack_sdk::api::network::v2::auto_allocated_topology::set; use openstack_sdk::api::QueryAsync; diff --git a/openstack_cli/tests/network/v2/auto_allocated_topology/mod.rs b/openstack_cli/tests/network/v2/auto_allocated_topology/mod.rs new file mode 100644 index 000000000..ec3f8c09e --- /dev/null +++ b/openstack_cli/tests/network/v2/auto_allocated_topology/mod.rs @@ -0,0 +1,34 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +mod create_autogen; +mod delete_autogen; +mod list_autogen; +mod set_autogen; +mod show_autogen; + +use assert_cmd::prelude::*; +use std::process::Command; + +#[test] +fn help() -> Result<(), Box> { + let mut cmd = Command::cargo_bin("osc")?; + + cmd.arg("network") + .arg("auto-allocated-topology") + .arg("--help"); + cmd.assert().success(); + + Ok(()) +} diff --git a/openstack_cli/tests/network/v2/mod.rs b/openstack_cli/tests/network/v2/mod.rs index 835c59a8b..3e79fa1f4 100644 --- a/openstack_cli/tests/network/v2/mod.rs +++ b/openstack_cli/tests/network/v2/mod.rs @@ -15,6 +15,7 @@ mod address_group; mod address_scope; mod agent; +mod auto_allocated_topology; mod availability_zone; mod extension; mod floatingip;