From 8ddbc9e8635c77efaf992ce46ddea50500bb6115 Mon Sep 17 00:00:00 2001 From: OpenStack codegenerator <16461884+gtema@users.noreply.github.com> Date: Mon, 22 Dec 2025 16:09:04 +0000 Subject: [PATCH] feat: Normalize bs.scheduler-stat naming Signed-off-by: Artem Goncharov Change-Id: Id181187a733678fb9834829d8ef879942802aaf7 Changes are triggered by https://review.opendev.org/c/openstack/codegenerator/+/971618 --- openstack_cli/src/block_storage/v3.rs | 3 + .../src/block_storage/v3/scheduler_stat.rs | 53 +++++++++++++ .../block_storage/v3/scheduler_stat/pool.rs | 54 +++++++++++++ .../{get_pool/get.rs => pool/list.rs} | 36 +++++---- openstack_cli/tests/block_storage/v3/mod.rs | 1 + .../block_storage/v3/scheduler_stat/mod.rs | 28 +++++++ .../get_autogen.rs => pool/list_autogen.rs} | 4 +- .../v3/scheduler_stat/pool/mod.rs | 28 +++++++ .../api/block_storage/v3/scheduler_stat.rs | 2 +- .../scheduler_stat/{get_pool.rs => pool.rs} | 2 +- .../{get_pool/get.rs => pool/list.rs} | 24 ++++-- openstack_types/data/block-storage/v3.71.yaml | 77 ++++++++++++++++++- openstack_types/data/block-storage/v3.yaml | 77 ++++++++++++++++++- .../src/block_storage/v3/scheduler_stat.rs | 2 +- .../scheduler_stat/get_pool/response/get.rs | 46 ----------- .../scheduler_stat/{get_pool.rs => pool.rs} | 0 .../{get_pool => pool}/response.rs | 2 +- .../v3/scheduler_stat/pool/response/list.rs | 60 +++++++++++++++ 18 files changed, 424 insertions(+), 75 deletions(-) create mode 100644 openstack_cli/src/block_storage/v3/scheduler_stat.rs create mode 100644 openstack_cli/src/block_storage/v3/scheduler_stat/pool.rs rename openstack_cli/src/block_storage/v3/scheduler_stat/{get_pool/get.rs => pool/list.rs} (65%) create mode 100644 openstack_cli/tests/block_storage/v3/scheduler_stat/mod.rs rename openstack_cli/tests/block_storage/v3/scheduler_stat/{get_pool/get_autogen.rs => pool/list_autogen.rs} (95%) create mode 100644 openstack_cli/tests/block_storage/v3/scheduler_stat/pool/mod.rs rename openstack_sdk/src/api/block_storage/v3/scheduler_stat/{get_pool.rs => pool.rs} (98%) rename openstack_sdk/src/api/block_storage/v3/scheduler_stat/{get_pool/get.rs => pool/list.rs} (87%) delete mode 100644 openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response/get.rs rename openstack_types/src/block_storage/v3/scheduler_stat/{get_pool.rs => pool.rs} (100%) rename openstack_types/src/block_storage/v3/scheduler_stat/{get_pool => pool}/response.rs (98%) create mode 100644 openstack_types/src/block_storage/v3/scheduler_stat/pool/response/list.rs diff --git a/openstack_cli/src/block_storage/v3.rs b/openstack_cli/src/block_storage/v3.rs index 90badc8c6..55dd4e76d 100644 --- a/openstack_cli/src/block_storage/v3.rs +++ b/openstack_cli/src/block_storage/v3.rs @@ -36,6 +36,7 @@ pub mod qos_spec; pub mod quota_class_set; pub mod quota_set; pub mod resource_filter; +pub mod scheduler_stat; pub mod service; pub mod snapshot; pub mod snapshot_manage; @@ -72,6 +73,7 @@ pub enum BlockStorageCommands { QosSpec(Box), QuotaClassSet(Box), QuotaSet(Box), + SchedulerStat(Box), Service(Box), Snapshot(Box), SnapshotManage(Box), @@ -114,6 +116,7 @@ impl BlockStorageCommand { BlockStorageCommands::QosSpec(cmd) => cmd.take_action(parsed_args, session).await, BlockStorageCommands::QuotaClassSet(cmd) => cmd.take_action(parsed_args, session).await, BlockStorageCommands::QuotaSet(cmd) => cmd.take_action(parsed_args, session).await, + BlockStorageCommands::SchedulerStat(cmd) => cmd.take_action(parsed_args, session).await, BlockStorageCommands::Service(cmd) => cmd.take_action(parsed_args, session).await, BlockStorageCommands::Snapshot(cmd) => cmd.take_action(parsed_args, session).await, BlockStorageCommands::SnapshotManage(cmd) => { diff --git a/openstack_cli/src/block_storage/v3/scheduler_stat.rs b/openstack_cli/src/block_storage/v3/scheduler_stat.rs new file mode 100644 index 000000000..9cccc1121 --- /dev/null +++ b/openstack_cli/src/block_storage/v3/scheduler_stat.rs @@ -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 + +//! Block storage Scheduler stat +//! + +use clap::{Parser, Subcommand}; + +use crate::{Cli, OpenStackCliError}; + +use openstack_sdk::AsyncOpenStack; + +pub mod pool; + +/// Back-end storage pools +/// Administrator only. Lists all back-end storage pools that are known to the scheduler service. +#[derive(Parser)] +pub struct SchedulerStatCommand { + /// subcommand + #[command(subcommand)] + command: SchedulerStatCommands, +} + +/// Supported subcommands +#[allow(missing_docs)] +#[derive(Subcommand)] +pub enum SchedulerStatCommands { + Pool(Box), +} + +impl SchedulerStatCommand { + /// Perform command action + pub async fn take_action( + &self, + parsed_args: &Cli, + session: &mut AsyncOpenStack, + ) -> Result<(), OpenStackCliError> { + match &self.command { + SchedulerStatCommands::Pool(cmd) => cmd.take_action(parsed_args, session).await, + } + } +} diff --git a/openstack_cli/src/block_storage/v3/scheduler_stat/pool.rs b/openstack_cli/src/block_storage/v3/scheduler_stat/pool.rs new file mode 100644 index 000000000..f9afe6e9e --- /dev/null +++ b/openstack_cli/src/block_storage/v3/scheduler_stat/pool.rs @@ -0,0 +1,54 @@ +// 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 + +//! Block storage Scheduler stat pools. +//! + +use clap::{Parser, Subcommand}; + +use crate::{Cli, OpenStackCliError}; + +use openstack_sdk::AsyncOpenStack; + +pub mod list; + +/// Back-end storage pools +/// +/// Administrator only. Lists all back-end storage pools that are known to the scheduler service. +#[derive(Parser)] +pub struct PoolCommand { + /// subcommand + #[command(subcommand)] + command: PoolCommands, +} + +/// Supported subcommands +#[allow(missing_docs)] +#[derive(Subcommand)] +pub enum PoolCommands { + List(Box), +} + +impl PoolCommand { + /// Perform command action + pub async fn take_action( + &self, + parsed_args: &Cli, + session: &mut AsyncOpenStack, + ) -> Result<(), OpenStackCliError> { + match &self.command { + PoolCommands::List(cmd) => cmd.take_action(parsed_args, session).await, + } + } +} diff --git a/openstack_cli/src/block_storage/v3/scheduler_stat/get_pool/get.rs b/openstack_cli/src/block_storage/v3/scheduler_stat/pool/list.rs similarity index 65% rename from openstack_cli/src/block_storage/v3/scheduler_stat/get_pool/get.rs rename to openstack_cli/src/block_storage/v3/scheduler_stat/pool/list.rs index e55c22694..4bbdb6d88 100644 --- a/openstack_cli/src/block_storage/v3/scheduler_stat/get_pool/get.rs +++ b/openstack_cli/src/block_storage/v3/scheduler_stat/pool/list.rs @@ -15,12 +15,11 @@ // WARNING: This file is automatically generated from OpenAPI schema using // `openstack-codegenerator`. -//! Get GetPool command +//! List Pools command //! //! Wraps invoking of the `v3/scheduler-stats/get_pools` with `GET` method use clap::Args; -use eyre::{OptionExt, WrapErr}; use tracing::info; use openstack_sdk::AsyncOpenStack; @@ -30,12 +29,12 @@ use crate::OpenStackCliError; use crate::output::OutputProcessor; use openstack_sdk::api::QueryAsync; -use openstack_sdk::api::block_storage::v3::scheduler_stat::get_pool::get; -use openstack_types::block_storage::v3::scheduler_stat::get_pool::response::get::GetPoolResponse; +use openstack_sdk::api::block_storage::v3::scheduler_stat::pool::list; +use openstack_types::block_storage::v3::scheduler_stat::pool::response::list::PoolResponse; /// List all active pools in scheduler. #[derive(Args)] -pub struct GetPoolCommand { +pub struct PoolsCommand { /// Request Query parameters #[command(flatten)] query: QueryParameters, @@ -47,36 +46,47 @@ pub struct GetPoolCommand { /// Query parameters #[derive(Args)] -struct QueryParameters {} +struct QueryParameters { + /// Indicates whether to show pool details or only pool names in the + /// response. Set to true to show pool details. Set to false to show only + /// pool names. Default is false. + #[arg(action=clap::ArgAction::Set, help_heading = "Query parameters", long)] + detail: Option, +} /// Path parameters #[derive(Args)] struct PathParameters {} -impl GetPoolCommand { +impl PoolsCommand { /// Perform command action pub async fn take_action( &self, parsed_args: &Cli, client: &mut AsyncOpenStack, ) -> Result<(), OpenStackCliError> { - info!("Get GetPool"); + info!("List Pools"); let op = OutputProcessor::from_args( parsed_args, - Some("block-storage.scheduler_stat/get_pool"), - Some("get"), + Some("block-storage.scheduler_stats/pool"), + Some("list"), ); op.validate_args(parsed_args)?; - let ep_builder = get::Request::builder(); + let mut ep_builder = list::Request::builder(); + + // Set query parameters + if let Some(val) = &self.query.detail { + ep_builder.detail(*val); + } let ep = ep_builder .build() .map_err(|x| OpenStackCliError::EndpointBuild(x.to_string()))?; - let data = ep.query_async(client).await?; - op.output_single::(data)?; + let data: Vec = ep.query_async(client).await?; + op.output_list::(data)?; // Show command specific hints op.show_command_hint()?; Ok(()) diff --git a/openstack_cli/tests/block_storage/v3/mod.rs b/openstack_cli/tests/block_storage/v3/mod.rs index 52a93b0a8..b1d68b5fe 100644 --- a/openstack_cli/tests/block_storage/v3/mod.rs +++ b/openstack_cli/tests/block_storage/v3/mod.rs @@ -27,6 +27,7 @@ mod qos_spec; mod quota_class_set; mod quota_set; mod resource_filter; +mod scheduler_stat; mod service; mod snapshot; mod snapshot_manage; diff --git a/openstack_cli/tests/block_storage/v3/scheduler_stat/mod.rs b/openstack_cli/tests/block_storage/v3/scheduler_stat/mod.rs new file mode 100644 index 000000000..23f1a99da --- /dev/null +++ b/openstack_cli/tests/block_storage/v3/scheduler_stat/mod.rs @@ -0,0 +1,28 @@ +// 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 pool; + +use assert_cmd::prelude::*; +use std::process::Command; + +#[test] +fn help() -> Result<(), Box> { + let mut cmd = Command::cargo_bin("osc")?; + + cmd.args(["block-storage", "scheduler-stat", "--help"]); + cmd.assert().success(); + + Ok(()) +} diff --git a/openstack_cli/tests/block_storage/v3/scheduler_stat/get_pool/get_autogen.rs b/openstack_cli/tests/block_storage/v3/scheduler_stat/pool/list_autogen.rs similarity index 95% rename from openstack_cli/tests/block_storage/v3/scheduler_stat/get_pool/get_autogen.rs rename to openstack_cli/tests/block_storage/v3/scheduler_stat/pool/list_autogen.rs index b0ee63ad7..c828c3b31 100644 --- a/openstack_cli/tests/block_storage/v3/scheduler_stat/get_pool/get_autogen.rs +++ b/openstack_cli/tests/block_storage/v3/scheduler_stat/pool/list_autogen.rs @@ -24,8 +24,8 @@ fn help() -> Result<(), Box> { cmd.arg("block-storage") .arg("scheduler-stat") - .arg("get-pool") - .arg("get") + .arg("pool") + .arg("list") .arg("--help"); cmd.assert().success(); diff --git a/openstack_cli/tests/block_storage/v3/scheduler_stat/pool/mod.rs b/openstack_cli/tests/block_storage/v3/scheduler_stat/pool/mod.rs new file mode 100644 index 000000000..6d7b709f2 --- /dev/null +++ b/openstack_cli/tests/block_storage/v3/scheduler_stat/pool/mod.rs @@ -0,0 +1,28 @@ +// 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> { + let mut cmd = Command::cargo_bin("osc")?; + + cmd.args(["block-storage", "scheduler-stat", "pool", "--help"]); + cmd.assert().success(); + + Ok(()) +} diff --git a/openstack_sdk/src/api/block_storage/v3/scheduler_stat.rs b/openstack_sdk/src/api/block_storage/v3/scheduler_stat.rs index 7c4bc9ebd..368e026da 100644 --- a/openstack_sdk/src/api/block_storage/v3/scheduler_stat.rs +++ b/openstack_sdk/src/api/block_storage/v3/scheduler_stat.rs @@ -16,4 +16,4 @@ // `openstack-codegenerator`. //! `/v3/workers/cleanup` REST operations of block_storage -pub mod get_pool; +pub mod pool; diff --git a/openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool.rs b/openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool.rs similarity index 98% rename from openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool.rs rename to openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool.rs index 63b3efaa6..49a8e8ee6 100644 --- a/openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool.rs +++ b/openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool.rs @@ -16,4 +16,4 @@ // `openstack-codegenerator`. //! `/v3/scheduler-stats/get_pools` REST operations of block_storage -pub mod get; +pub mod list; diff --git a/openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool/get.rs b/openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool/list.rs similarity index 87% rename from openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool/get.rs rename to openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool/list.rs index 884296a1e..b2f72cdd6 100644 --- a/openstack_sdk/src/api/block_storage/v3/scheduler_stat/get_pool/get.rs +++ b/openstack_sdk/src/api/block_storage/v3/scheduler_stat/pool/list.rs @@ -25,6 +25,12 @@ use crate::api::rest_endpoint_prelude::*; #[derive(Builder, Debug, Clone)] #[builder(setter(strip_option))] pub struct Request { + /// Indicates whether to show pool details or only pool names in the + /// response. Set to true to show pool details. Set to false to show only + /// pool names. Default is false. + #[builder(default)] + detail: Option, + #[builder(setter(name = "_headers"), default, private)] _headers: Option, } @@ -36,7 +42,7 @@ impl Request { } impl RequestBuilder { - /// Add a single header to the Get_Pool. + /// Add a single header to the Pool. pub fn header(&mut self, header_name: K, header_value: V) -> &mut Self where K: Into, @@ -73,7 +79,10 @@ impl RestEndpoint for Request { } fn parameters(&self) -> QueryParams<'_> { - QueryParams::default() + let mut params = QueryParams::default(); + params.push_opt("detail", self.detail); + + params } fn service_type(&self) -> ServiceType { @@ -81,7 +90,7 @@ impl RestEndpoint for Request { } fn response_key(&self) -> Option> { - None + Some("pools".into()) } /// Returns headers to be set into the request @@ -116,7 +125,10 @@ mod tests { #[test] fn test_response_key() { - assert!(Request::builder().build().unwrap().response_key().is_none()) + assert_eq!( + Request::builder().build().unwrap().response_key().unwrap(), + "pools" + ); } #[cfg(feature = "sync")] @@ -130,7 +142,7 @@ mod tests { then.status(200) .header("content-type", "application/json") - .json_body(json!({ "dummy": {} })); + .json_body(json!({ "pools": {} })); }); let endpoint = Request::builder().build().unwrap(); @@ -150,7 +162,7 @@ mod tests { .header("not_foo", "not_bar"); then.status(200) .header("content-type", "application/json") - .json_body(json!({ "dummy": {} })); + .json_body(json!({ "pools": {} })); }); let endpoint = Request::builder() diff --git a/openstack_types/data/block-storage/v3.71.yaml b/openstack_types/data/block-storage/v3.71.yaml index 08a122765..d85c1ee50 100644 --- a/openstack_types/data/block-storage/v3.71.yaml +++ b/openstack_types/data/block-storage/v3.71.yaml @@ -2459,6 +2459,8 @@ paths: description: |- List all active pools in scheduler. operationId: scheduler-stats/get_pools:get + parameters: + - $ref: '#/components/parameters/detail' responses: '200': content: @@ -7712,6 +7714,14 @@ components: type: string x-openstack: resource_link: identity/v3/project.id + detail: + description: Indicates whether to show pool details or only pool names in + the response. Set to true to show pool details. Set to false to show + only pool names. Default is false. + in: query + name: detail + schema: + type: boolean extensions_project_id: description: project_id parameter for /v3/{project_id}/extensions API in: path @@ -15838,8 +15848,71 @@ components: description: Response of the :get operation type: object Scheduler_StatsGet_PoolsResponse: - description: Response of the project_id/scheduler-stats/get_pools:get - operation + properties: + pools: + description: |- + List of storage pools. + items: + properties: + capabilities: + description: |- + The capabilities for the back end. The value is + either `null` or a string value that indicates the capabilities + for each pool. For example, `total_capacity_gb` or `QoS_support`. + properties: + QoS_support: + description: |- + The quality of service (QoS) support. + type: boolean + driver_version: + description: |- + The driver version. + type: string + free_capacity_gb: + description: |- + The amount of free capacity for the back-end + volume, in GBs. A valid value is a string, such as `unknown`, or + a number (integer or floating point). + minimum: 0 + type: + - integer + - string + reserved_percentage: + description: |- + The percentage of the total capacity that is + reserved for the internal use by the back end. + type: integer + storage_protocol: + description: |- + The storage back end for the back-end volume. For + example, `iSCSI` or `FC`. + type: string + total_capacity_gb: + description: |- + The total capacity for the back-end volume, in + GBs. A valid value is a string, such as `unknown`, or a + number (integer or floating point). + minimum: 0 + type: + - integer + - string + updated: + description: |- + The date and time stamp when the extension was + last updated. + format: date-time + type: string + volume_backend_name: + description: |- + The name of the back-end volume. + type: string + type: object + name: + description: |- + The name of the backend pool. + type: string + type: object + type: array type: object SnapshotShowResponse: additionalProperties: false diff --git a/openstack_types/data/block-storage/v3.yaml b/openstack_types/data/block-storage/v3.yaml index 08a122765..d85c1ee50 100644 --- a/openstack_types/data/block-storage/v3.yaml +++ b/openstack_types/data/block-storage/v3.yaml @@ -2459,6 +2459,8 @@ paths: description: |- List all active pools in scheduler. operationId: scheduler-stats/get_pools:get + parameters: + - $ref: '#/components/parameters/detail' responses: '200': content: @@ -7712,6 +7714,14 @@ components: type: string x-openstack: resource_link: identity/v3/project.id + detail: + description: Indicates whether to show pool details or only pool names in + the response. Set to true to show pool details. Set to false to show + only pool names. Default is false. + in: query + name: detail + schema: + type: boolean extensions_project_id: description: project_id parameter for /v3/{project_id}/extensions API in: path @@ -15838,8 +15848,71 @@ components: description: Response of the :get operation type: object Scheduler_StatsGet_PoolsResponse: - description: Response of the project_id/scheduler-stats/get_pools:get - operation + properties: + pools: + description: |- + List of storage pools. + items: + properties: + capabilities: + description: |- + The capabilities for the back end. The value is + either `null` or a string value that indicates the capabilities + for each pool. For example, `total_capacity_gb` or `QoS_support`. + properties: + QoS_support: + description: |- + The quality of service (QoS) support. + type: boolean + driver_version: + description: |- + The driver version. + type: string + free_capacity_gb: + description: |- + The amount of free capacity for the back-end + volume, in GBs. A valid value is a string, such as `unknown`, or + a number (integer or floating point). + minimum: 0 + type: + - integer + - string + reserved_percentage: + description: |- + The percentage of the total capacity that is + reserved for the internal use by the back end. + type: integer + storage_protocol: + description: |- + The storage back end for the back-end volume. For + example, `iSCSI` or `FC`. + type: string + total_capacity_gb: + description: |- + The total capacity for the back-end volume, in + GBs. A valid value is a string, such as `unknown`, or a + number (integer or floating point). + minimum: 0 + type: + - integer + - string + updated: + description: |- + The date and time stamp when the extension was + last updated. + format: date-time + type: string + volume_backend_name: + description: |- + The name of the back-end volume. + type: string + type: object + name: + description: |- + The name of the backend pool. + type: string + type: object + type: array type: object SnapshotShowResponse: additionalProperties: false diff --git a/openstack_types/src/block_storage/v3/scheduler_stat.rs b/openstack_types/src/block_storage/v3/scheduler_stat.rs index fb67be8ef..4b9b19db4 100644 --- a/openstack_types/src/block_storage/v3/scheduler_stat.rs +++ b/openstack_types/src/block_storage/v3/scheduler_stat.rs @@ -16,4 +16,4 @@ // `openstack-codegenerator`. //! `block_storage/v3/worker/cleanup` REST operations of block_storage -pub mod get_pool; +pub mod pool; diff --git a/openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response/get.rs b/openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response/get.rs deleted file mode 100644 index 2f74a5b72..000000000 --- a/openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response/get.rs +++ /dev/null @@ -1,46 +0,0 @@ -// 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`. -//! Response type for the GET `scheduler-stats/get_pools` operation - -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use std::collections::BTreeMap; -use structable::{StructTable, StructTableOptions}; - -/// Response data as HashMap type -#[derive(Deserialize, Serialize)] -pub struct GetPoolResponse(BTreeMap); - -impl StructTable for GetPoolResponse { - fn instance_headers(&self, _options: &O) -> Option> { - Some(self.0.keys().map(Into::into).collect()) - } - - fn data(&self, _options: &O) -> Vec> { - Vec::from_iter(self.0.values().map(|v| serde_json::to_string(&v).ok())) - } -} - -impl StructTable for &GetPoolResponse { - fn instance_headers(&self, _options: &O) -> Option> { - Some(self.0.keys().map(Into::into).collect()) - } - - fn data(&self, _options: &O) -> Vec> { - Vec::from_iter(self.0.values().map(|v| serde_json::to_string(&v).ok())) - } -} diff --git a/openstack_types/src/block_storage/v3/scheduler_stat/get_pool.rs b/openstack_types/src/block_storage/v3/scheduler_stat/pool.rs similarity index 100% rename from openstack_types/src/block_storage/v3/scheduler_stat/get_pool.rs rename to openstack_types/src/block_storage/v3/scheduler_stat/pool.rs diff --git a/openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response.rs b/openstack_types/src/block_storage/v3/scheduler_stat/pool/response.rs similarity index 98% rename from openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response.rs rename to openstack_types/src/block_storage/v3/scheduler_stat/pool/response.rs index 0802531cf..d4e26885e 100644 --- a/openstack_types/src/block_storage/v3/scheduler_stat/get_pool/response.rs +++ b/openstack_types/src/block_storage/v3/scheduler_stat/pool/response.rs @@ -16,4 +16,4 @@ // `openstack-codegenerator`. //! `response` REST operations of block_storage -pub mod get; +pub mod list; diff --git a/openstack_types/src/block_storage/v3/scheduler_stat/pool/response/list.rs b/openstack_types/src/block_storage/v3/scheduler_stat/pool/response/list.rs new file mode 100644 index 000000000..908ee305f --- /dev/null +++ b/openstack_types/src/block_storage/v3/scheduler_stat/pool/response/list.rs @@ -0,0 +1,60 @@ +// 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`. +//! Response type for the GET `scheduler-stats/get_pools` operation + +use serde::{Deserialize, Serialize}; +use structable::{StructTable, StructTableOptions}; + +/// Pool response representation +#[derive(Clone, Deserialize, Serialize, StructTable)] +pub struct PoolResponse { + /// The capabilities for the back end. The value is either `null` or a + /// string value that indicates the capabilities for each pool. For + /// example, `total_capacity_gb` or `QoS_support`. + #[serde(default)] + #[structable(optional, serialize)] + pub capabilities: Option, + + /// The name of the backend pool. + #[serde(default)] + #[structable(optional)] + pub name: Option, +} + +/// The capabilities for the back end. The value is either `null` or a string +/// value that indicates the capabilities for each pool. For example, +/// `total_capacity_gb` or `QoS_support`. +/// `Capabilities` type +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct Capabilities { + #[serde(default)] + pub driver_version: Option, + #[serde(default, deserialize_with = "crate::common::deser_num_str_opt")] + pub free_capacity_gb: Option, + #[serde(default, rename = "QoS_support")] + pub qo_s_support: Option, + #[serde(default)] + pub reserved_percentage: Option, + #[serde(default)] + pub storage_protocol: Option, + #[serde(default, deserialize_with = "crate::common::deser_num_str_opt")] + pub total_capacity_gb: Option, + #[serde(default)] + pub updated: Option, + #[serde(default)] + pub volume_backend_name: Option, +}