confluent_kafka/admin/alter_configs_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::incremental_alter_configs`.
16
17use std::collections::HashMap;
18
19use crate::common::KafkaFuture;
20use crate::common::config::ConfigResource;
21
22/// The result of the `Admin::incremental_alter_configs` call.
23#[derive(Debug)]
24#[doc(alias = "org.apache.kafka.clients.admin.AlterConfigsResult")]
25pub struct AlterConfigsResult {
26 futures: HashMap<ConfigResource, KafkaFuture<()>>,
27}
28
29impl AlterConfigsResult {
30 /// Creates a new result from the per-resource futures.
31 #[doc(alias = "org.apache.kafka.clients.admin.AlterConfigsResult#AlterConfigsResult")]
32 pub(crate) fn new(futures: HashMap<ConfigResource, KafkaFuture<()>>) -> Self {
33 Self { futures }
34 }
35
36 /// Returns a map from resources to futures which can be used to check the
37 /// status of the alteration for each resource.
38 #[doc(alias = "org.apache.kafka.clients.admin.AlterConfigsResult#values")]
39 pub fn values(&self) -> &HashMap<ConfigResource, KafkaFuture<()>> {
40 &self.futures
41 }
42
43 /// Returns a future which succeeds only if all the alteration requests
44 /// succeed.
45 #[doc(alias = "org.apache.kafka.clients.admin.AlterConfigsResult#all")]
46 pub fn all(&self) -> KafkaFuture<()> {
47 KafkaFuture::all_of(self.futures.values().cloned().collect())
48 }
49}