-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add volume.az and fix compute.az to not to require "-o wide".
- Loading branch information
Showing
11 changed files
with
431 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 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 | ||
|
||
//! Availability zone management | ||
use clap::{Parser, Subcommand}; | ||
|
||
use openstack_sdk::AsyncOpenStack; | ||
|
||
use crate::{Cli, OpenStackCliError}; | ||
|
||
mod list; | ||
|
||
/// Availability zones | ||
/// | ||
/// Lists and gets detailed availability zone information. | ||
#[derive(Parser)] | ||
pub struct AvailabilityZoneCommand { | ||
/// subcommand | ||
#[command(subcommand)] | ||
command: AvailabilityZoneCommands, | ||
} | ||
|
||
/// Supported subcommands | ||
#[allow(missing_docs)] | ||
#[derive(Subcommand)] | ||
pub enum AvailabilityZoneCommands { | ||
List(list::AvailabilityZonesCommand), | ||
} | ||
|
||
impl AvailabilityZoneCommand { | ||
/// Perform command action | ||
pub async fn take_action( | ||
&self, | ||
parsed_args: &Cli, | ||
session: &mut AsyncOpenStack, | ||
) -> Result<(), OpenStackCliError> { | ||
match &self.command { | ||
AvailabilityZoneCommands::List(cmd) => cmd.take_action(parsed_args, session).await, | ||
} | ||
} | ||
} |
102 changes: 102 additions & 0 deletions
102
openstack_cli/src/block_storage/v3/availability_zone/list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// 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 | ||
// | ||
// WARNING: This file is automatically generated from OpenAPI schema using | ||
// `openstack-codegenerator`. | ||
|
||
//! List AvailabilityZones command | ||
//! | ||
//! Wraps invoking of the `v3/os-availability-zone` with `GET` method | ||
use clap::Args; | ||
use serde::{Deserialize, Serialize}; | ||
use tracing::info; | ||
|
||
use anyhow::Result; | ||
|
||
use openstack_sdk::AsyncOpenStack; | ||
|
||
use crate::output::OutputProcessor; | ||
use crate::Cli; | ||
use crate::OpenStackCliError; | ||
use crate::OutputConfig; | ||
use crate::StructTable; | ||
|
||
use openstack_sdk::api::block_storage::v3::availability_zone::list; | ||
use openstack_sdk::api::QueryAsync; | ||
use serde_json::Value; | ||
use structable_derive::StructTable; | ||
|
||
/// Describe all known availability zones. | ||
/// | ||
#[derive(Args)] | ||
pub struct AvailabilityZonesCommand { | ||
/// Request Query parameters | ||
#[command(flatten)] | ||
query: QueryParameters, | ||
|
||
/// Path parameters | ||
#[command(flatten)] | ||
path: PathParameters, | ||
} | ||
|
||
/// Query parameters | ||
#[derive(Args)] | ||
struct QueryParameters {} | ||
|
||
/// Path parameters | ||
#[derive(Args)] | ||
struct PathParameters {} | ||
/// AvailabilityZones response representation | ||
#[derive(Deserialize, Serialize, Clone, StructTable)] | ||
struct ResponseData { | ||
/// The availability zone name. | ||
/// | ||
#[serde(rename = "zoneName")] | ||
#[structable(optional, title = "zoneName")] | ||
zone_name: Option<String>, | ||
|
||
#[serde(rename = "zoneState")] | ||
#[structable(optional, pretty, title = "zoneState")] | ||
zone_state: Option<Value>, | ||
} | ||
|
||
impl AvailabilityZonesCommand { | ||
/// Perform command action | ||
pub async fn take_action( | ||
&self, | ||
parsed_args: &Cli, | ||
client: &mut AsyncOpenStack, | ||
) -> Result<(), OpenStackCliError> { | ||
info!("List AvailabilityZones"); | ||
|
||
let op = OutputProcessor::from_args(parsed_args); | ||
op.validate_args(parsed_args)?; | ||
|
||
let ep_builder = list::Request::builder(); | ||
|
||
// Set path parameters | ||
// Set query parameters | ||
// Set body parameters | ||
|
||
let ep = ep_builder | ||
.build() | ||
.map_err(|x| OpenStackCliError::EndpointBuild(x.to_string()))?; | ||
|
||
let data: Vec<serde_json::Value> = ep.query_async(client).await?; | ||
|
||
op.output_list::<ResponseData>(data)?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
openstack_cli/tests/block_storage/v3/availability_zone/list_autogen.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// 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 | ||
// | ||
// WARNING: This file is automatically generated from OpenAPI schema using | ||
// `openstack-codegenerator`. | ||
|
||
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("block-storage") | ||
.arg("availability-zone") | ||
.arg("list") | ||
.arg("--help"); | ||
cmd.assert().success(); | ||
|
||
Ok(()) | ||
} |
30 changes: 30 additions & 0 deletions
30
openstack_cli/tests/block_storage/v3/availability_zone/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// 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 list_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("block-storage") | ||
.arg("availability-zone") | ||
.arg("--help"); | ||
cmd.assert().success(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
openstack_sdk/src/api/block_storage/v3/availability_zone.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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 | ||
// | ||
// WARNING: This file is automatically generated from OpenAPI schema using | ||
// `openstack-codegenerator`. | ||
|
||
//! `/v3/os-availability-zone` REST operations of block_storage | ||
pub mod list; |
Oops, something went wrong.