openstack_cli_load_balancer/v2/quota/list.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// WARNING: This file is automatically generated from OpenAPI schema using
16// `openstack-codegenerator`.
17
18//! List Quotas command
19//!
20//! Wraps invoking of the `v2/lbaas/quotas` with `GET` method
21
22use clap::Args;
23use tracing::info;
24
25use openstack_cli_core::cli::CliArgs;
26use openstack_cli_core::error::OpenStackCliError;
27use openstack_cli_core::output::OutputProcessor;
28use openstack_sdk::AsyncOpenStack;
29
30use openstack_sdk::api::QueryAsync;
31use openstack_sdk::api::load_balancer::v2::quota::list;
32use openstack_types::load_balancer::v2::quota::response;
33
34/// Lists all quotas for the project.
35///
36/// Use the `fields` query parameter to control which fields are returned in
37/// the response body. Additionally, you can filter results by using query
38/// string parameters. For information, see
39/// [Filtering and column selection](#filtering).
40///
41/// Administrative users can specify a project ID that is different than their
42/// own to list quotas for other projects.
43///
44/// If the quota is listed as `null` the quota is using the deployment default
45/// quota settings.
46///
47/// A quota of `-1` means the quota is unlimited.
48///
49/// The list might be empty.
50#[derive(Args)]
51#[command(about = "List Quota")]
52pub struct QuotasCommand {
53 /// Request Query parameters
54 #[command(flatten)]
55 query: QueryParameters,
56
57 /// Path parameters
58 #[command(flatten)]
59 path: PathParameters,
60}
61
62/// Query parameters
63#[derive(Args)]
64struct QueryParameters {}
65
66/// Path parameters
67#[derive(Args)]
68struct PathParameters {}
69
70impl QuotasCommand {
71 /// Perform command action
72 pub async fn take_action<C: CliArgs>(
73 &self,
74 parsed_args: &C,
75 client: &mut AsyncOpenStack,
76 ) -> Result<(), OpenStackCliError> {
77 info!("List Quotas");
78
79 let op = OutputProcessor::from_args(parsed_args, Some("load-balancer.quota"), Some("list"));
80 op.validate_args(parsed_args)?;
81
82 let ep_builder = list::Request::builder();
83
84 let ep = ep_builder
85 .build()
86 .map_err(|x| OpenStackCliError::EndpointBuild(x.to_string()))?;
87
88 let data: Vec<serde_json::Value> = ep.query_async(client).await?;
89
90 op.output_list::<response::list::QuotaResponse>(data.clone())?;
91 // Show command specific hints
92 op.show_command_hint()?;
93 Ok(())
94 }
95}