Skip to main content

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