confluent_kafka/admin/describe_client_quotas_result.rs
1// Copyright 2025 Confluent Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! The result of `Admin::describe_client_quotas`.
16
17use std::collections::HashMap;
18
19use crate::common::KafkaFuture;
20use crate::common::quota::ClientQuotaEntity;
21
22/// The result of the `Admin::describe_client_quotas` call.
23#[derive(Clone, Debug)]
24#[doc(alias = "org.apache.kafka.clients.admin.DescribeClientQuotasResult")]
25pub struct DescribeClientQuotasResult {
26 entities: KafkaFuture<HashMap<ClientQuotaEntity, HashMap<String, f64>>>,
27}
28
29impl DescribeClientQuotasResult {
30 /// Maps an entity to its configured quota value(s). Note if no value is defined for a quota
31 /// type for that entity's config, then it is not included in the resulting value map.
32 ///
33 /// # Arguments
34 ///
35 /// - `entities` - future for the collection of entities that matched the filter
36 #[doc(alias = "org.apache.kafka.clients.admin.DescribeClientQuotasResult#DescribeClientQuotasResult")]
37 pub fn new(entities: KafkaFuture<HashMap<ClientQuotaEntity, HashMap<String, f64>>>) -> Self {
38 Self { entities }
39 }
40
41 /// Returns a map from quota entity to a future which can be used to check the status of
42 /// the operation.
43 #[doc(alias = "org.apache.kafka.clients.admin.DescribeClientQuotasResult#entities")]
44 pub fn entities(&self) -> &KafkaFuture<HashMap<ClientQuotaEntity, HashMap<String, f64>>> {
45 &self.entities
46 }
47}