Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions openstack_cli/src/network/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -50,6 +51,7 @@ pub enum NetworkCommands {
AddressGroup(Box<address_group::AddressGroupCommand>),
AddressScope(Box<address_scope::AddressScopeCommand>),
Agent(Box<agent::AgentCommand>),
AutoAllocatedTopology(Box<auto_allocated_topology::AutoAllocatedTopologyCommand>),
AvailabilityZone(Box<availability_zone::AvailabilityZoneCommand>),
Extension(Box<extension::ExtensionCommand>),
FloatingIP(Box<floatingip::FloatingIPCommand>),
Expand Down Expand Up @@ -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,
Expand Down
70 changes: 70 additions & 0 deletions openstack_cli/src/network/v2/auto_allocated_topology.rs
Original file line number Diff line number Diff line change
@@ -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<create::AutoAllocatedTopologyCommand>),
Delete(Box<delete::AutoAllocatedTopologyCommand>),
List(Box<list::AutoAllocatedTopologiesCommand>),
Set(Box<set::AutoAllocatedTopologyCommand>),
Show(Box<show::AutoAllocatedTopologyCommand>),
}

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,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
34 changes: 34 additions & 0 deletions openstack_cli/tests/network/v2/auto_allocated_topology/mod.rs
Original file line number Diff line number Diff line change
@@ -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<dyn std::error::Error>> {
let mut cmd = Command::cargo_bin("osc")?;

cmd.arg("network")
.arg("auto-allocated-topology")
.arg("--help");
cmd.assert().success();

Ok(())
}
1 change: 1 addition & 0 deletions openstack_cli/tests/network/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
mod address_group;
mod address_scope;
mod agent;
mod auto_allocated_topology;
mod availability_zone;
mod extension;
mod floatingip;
Expand Down