Skip to main content

confluent_kafka/admin/options/
describe_classic_groups_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_classic_groups`.
16
17/// Options for `Admin::describe_classic_groups`.
18#[derive(Clone, Debug, Default)]
19#[doc(alias = "org.apache.kafka.clients.admin.DescribeClassicGroupsOptions")]
20pub struct DescribeClassicGroupsOptions {
21    timeout_ms: Option<i32>,
22    include_authorized_operations: bool,
23}
24
25impl DescribeClassicGroupsOptions {
26    /// Creates default options.
27    #[doc(alias = "org.apache.kafka.clients.admin.DescribeClassicGroupsOptions#DescribeClassicGroupsOptions")]
28    pub fn new() -> Self {
29        Self::default()
30    }
31
32    /// Sets whether to include authorized operations in the description.
33    ///
34    /// # Arguments
35    ///
36    /// - `include_authorized_operations` - `true` to request the authorized operations.
37    ///
38    /// # Returns
39    ///
40    /// This `DescribeClassicGroupsOptions` instance.
41    #[must_use]
42    #[doc(alias = "org.apache.kafka.clients.admin.DescribeClassicGroupsOptions#includeAuthorizedOperations")]
43    pub fn set_include_authorized_operations(mut self, include_authorized_operations: bool) -> Self {
44        self.include_authorized_operations = include_authorized_operations;
45        self
46    }
47
48    /// Set the timeout in milliseconds for this operation, or `None` if the default
49    /// API timeout for the `AdminClient` should be used.
50    ///
51    /// # Arguments
52    ///
53    /// - `timeout_ms` - the timeout in milliseconds, or `None` for the default API timeout.
54    ///
55    /// # Returns
56    ///
57    /// This `DescribeClassicGroupsOptions` instance.
58    #[must_use]
59    #[doc(alias = "org.apache.kafka.clients.admin.AbstractOptions#timeoutMs")]
60    pub fn set_timeout_ms(mut self, timeout_ms: Option<i32>) -> Self {
61        self.timeout_ms = timeout_ms;
62        self
63    }
64
65    /// Returns whether authorized operations are requested.
66    #[doc(alias = "org.apache.kafka.clients.admin.DescribeClassicGroupsOptions#includeAuthorizedOperations")]
67    pub fn include_authorized_operations(&self) -> bool {
68        self.include_authorized_operations
69    }
70
71    /// Returns the timeout in milliseconds for this operation, or `None` if the
72    /// default API timeout for the `AdminClient` should be used.
73    #[doc(alias = "org.apache.kafka.clients.admin.AbstractOptions#timeoutMs")]
74    pub fn timeout_ms(&self) -> Option<i32> {
75        self.timeout_ms
76    }
77}
78
79#[cfg(test)]
80mod tests {
81    use super::*;
82
83    #[test]
84    fn defaults_and_setter() {
85        let options = DescribeClassicGroupsOptions::new();
86        assert!(!options.include_authorized_operations());
87        let options = options.set_include_authorized_operations(true);
88        assert!(options.include_authorized_operations());
89    }
90}