Skip to main content

confluent_kafka/admin/options/
describe_acls_options.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//! Options for `Admin::describe_acls`.
16
17/// Options for `Admin::describe_acls`.
18#[derive(Clone, Debug, Default)]
19#[doc(alias = "org.apache.kafka.clients.admin.DescribeAclsOptions")]
20pub struct DescribeAclsOptions {
21    timeout_ms: Option<i32>,
22}
23
24impl DescribeAclsOptions {
25    /// Creates default options (default API timeout).
26    #[doc(alias = "org.apache.kafka.clients.admin.DescribeAclsOptions#DescribeAclsOptions")]
27    pub fn new() -> Self {
28        Self::default()
29    }
30
31    /// Set the timeout in milliseconds for this operation, or `None` if the default
32    /// API timeout for the `AdminClient` should be used.
33    ///
34    /// # Arguments
35    ///
36    /// - `timeout_ms` - the timeout in milliseconds, or `None` for the default API timeout.
37    ///
38    /// # Returns
39    ///
40    /// This `DescribeAclsOptions` instance.
41    #[must_use]
42    #[doc(alias = "org.apache.kafka.clients.admin.DescribeAclsOptions#timeoutMs")]
43    pub fn set_timeout_ms(mut self, timeout_ms: Option<i32>) -> Self {
44        self.timeout_ms = timeout_ms;
45        self
46    }
47
48    /// Returns the timeout in milliseconds for this operation, or `None` if the
49    /// default API timeout for the `AdminClient` should be used.
50    #[doc(alias = "org.apache.kafka.clients.admin.DescribeAclsOptions#timeoutMs")]
51    pub fn timeout_ms(&self) -> Option<i32> {
52        self.timeout_ms
53    }
54}
55
56#[cfg(test)]
57mod tests {
58    use super::*;
59
60    #[test]
61    fn defaults_and_setter() {
62        assert_eq!(DescribeAclsOptions::new().timeout_ms(), None);
63        assert_eq!(DescribeAclsOptions::new().set_timeout_ms(Some(5000)).timeout_ms(), Some(5000));
64    }
65}