Skip to main content

kafka_client_engine/admin/describe_share_group/
result.rs

1//! Stable generated-free results for Admin `DescribeShareGroup`.
2
3/// One assigned topic and its deterministic partition set.
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct DescribeShareGroupTopicAssignment {
6    pub(super) topic_id: [u8; 16],
7    pub(super) topic_name: String,
8    pub(super) partitions: Vec<i32>,
9}
10
11impl DescribeShareGroupTopicAssignment {
12    /// Consumes this topic into exact stable parts.
13    pub fn into_parts(self) -> ([u8; 16], String, Vec<i32>) {
14        (self.topic_id, self.topic_name, self.partitions)
15    }
16}
17
18/// One member's current assignment.
19#[derive(Clone, Debug, Eq, PartialEq)]
20pub struct DescribeShareGroupAssignment {
21    pub(super) topics: Vec<DescribeShareGroupTopicAssignment>,
22}
23
24impl DescribeShareGroupAssignment {
25    /// Consumes this assignment into deterministic topic assignments.
26    pub fn into_topics(self) -> Vec<DescribeShareGroupTopicAssignment> {
27        self.topics
28    }
29}
30
31/// One stable share-group member description.
32#[derive(Clone, Debug, Eq, PartialEq)]
33pub struct DescribeShareGroupMember {
34    pub(super) member_id: String,
35    pub(super) rack_id: Option<String>,
36    pub(super) member_epoch: i32,
37    pub(super) client_id: String,
38    pub(super) client_host: String,
39    pub(super) subscribed_topic_names: Vec<String>,
40    pub(super) assignment: DescribeShareGroupAssignment,
41}
42
43impl DescribeShareGroupMember {
44    /// Consumes this member into exact stable parts.
45    #[allow(clippy::type_complexity)]
46    pub fn into_parts(
47        self,
48    ) -> (
49        String,
50        Option<String>,
51        i32,
52        String,
53        String,
54        Vec<String>,
55        DescribeShareGroupAssignment,
56    ) {
57        (
58            self.member_id,
59            self.rack_id,
60            self.member_epoch,
61            self.client_id,
62            self.client_host,
63            self.subscribed_topic_names,
64            self.assignment,
65        )
66    }
67}
68
69/// Successful description of one exact share group.
70#[derive(Clone, Debug, Eq, PartialEq)]
71pub struct DescribeShareGroupDescription {
72    pub(super) group_id: String,
73    pub(super) state: String,
74    pub(super) group_epoch: i32,
75    pub(super) assignment_epoch: i32,
76    pub(super) assignor_name: String,
77    pub(super) members: Vec<DescribeShareGroupMember>,
78    pub(super) authorized_operations: Option<i32>,
79}
80
81impl DescribeShareGroupDescription {
82    /// Returns the exact requested share-group identity.
83    pub fn group_id(&self) -> &str {
84        &self.group_id
85    }
86
87    /// Consumes this description into exact stable parts.
88    #[allow(clippy::type_complexity)]
89    pub fn into_parts(
90        self,
91    ) -> (
92        String,
93        String,
94        i32,
95        i32,
96        String,
97        Vec<DescribeShareGroupMember>,
98        Option<i32>,
99    ) {
100        (
101            self.group_id,
102            self.state,
103            self.group_epoch,
104            self.assignment_epoch,
105            self.assignor_name,
106            self.members,
107            self.authorized_operations,
108        )
109    }
110}
111
112/// Successful API-77 result plus Kafka's throttle observation.
113#[derive(Clone, Debug, Eq, PartialEq)]
114pub struct DescribeShareGroupResult {
115    pub(super) throttle_time_ms: u32,
116    pub(super) description: DescribeShareGroupDescription,
117}
118
119impl DescribeShareGroupResult {
120    /// Returns Kafka's nonnegative throttle observation.
121    pub const fn throttle_time_ms(&self) -> u32 {
122        self.throttle_time_ms
123    }
124
125    /// Returns the exact share-group description.
126    pub const fn description(&self) -> &DescribeShareGroupDescription {
127        &self.description
128    }
129
130    /// Consumes this result into exact stable parts.
131    pub fn into_parts(self) -> (u32, DescribeShareGroupDescription) {
132        (self.throttle_time_ms, self.description)
133    }
134}