1use bytes::{Buf, BufMut};
4
5use crate::{
6 Decode, Encode, ProtocolError, UnknownTaggedFields,
7 primitives::{
8 fixed::{get_bool, get_i8, get_i16, get_i32, put_bool, put_i8, put_i16, put_i32},
9 string_bytes::{
10 compact_nullable_string_len, compact_string_len, get_compact_nullable_string_owned,
11 get_compact_string_owned, get_nullable_string_owned, get_string_owned,
12 nullable_string_len, put_compact_nullable_string, put_compact_string,
13 put_nullable_string, put_string, string_len,
14 },
15 },
16 tagged_fields::{WriteTaggedFields, read_tagged_fields, tagged_fields_len},
17};
18pub const API_KEY: i16 = 89;
19pub const MIN_VERSION: i16 = 0;
20pub const MAX_VERSION: i16 = 1;
21pub const FLEXIBLE_MIN: i16 = 0;
22#[inline]
23#[must_use]
24pub fn is_flexible(version: i16) -> bool {
25 version >= FLEXIBLE_MIN
26}
27#[derive(Debug, Clone, PartialEq, Eq, Default)]
28pub struct StreamsGroupDescribeResponse {
29 pub throttle_time_ms: i32,
30 pub groups: Vec<DescribedGroup>,
31 pub unknown_tagged_fields: UnknownTaggedFields,
32}
33impl Encode for StreamsGroupDescribeResponse {
34 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
35 if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
36 return Err(ProtocolError::UnsupportedVersion {
37 api_key: API_KEY,
38 version,
39 });
40 }
41 let flex = is_flexible(version);
42 if version >= 0 {
43 put_i32(buf, self.throttle_time_ms);
44 }
45 if version >= 0 {
46 {
47 crate::primitives::array::put_array_len(buf, (self.groups).len(), flex);
48 for it in &self.groups {
49 it.encode(buf, version)?;
50 }
51 };
52 }
53 if flex {
54 let tagged = WriteTaggedFields::new();
55 tagged.write(buf, &self.unknown_tagged_fields);
56 }
57 Ok(())
58 }
59 fn encoded_len(&self, version: i16) -> usize {
60 let flex = is_flexible(version);
61 let mut n: usize = 0;
62 if version >= 0 {
63 n += 4;
64 }
65 if version >= 0 {
66 n += {
67 let prefix =
68 crate::primitives::array::array_len_prefix_len((self.groups).len(), flex);
69 let body: usize = (self.groups).iter().map(|it| it.encoded_len(version)).sum();
70 prefix + body
71 };
72 }
73 if flex {
74 let known_pairs: Vec<(u32, usize)> = Vec::new();
75 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
76 }
77 n
78 }
79}
80impl Decode<'_> for StreamsGroupDescribeResponse {
81 fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
82 if !(MIN_VERSION..=MAX_VERSION).contains(&version) {
83 return Err(ProtocolError::UnsupportedVersion {
84 api_key: API_KEY,
85 version,
86 });
87 }
88 let flex = is_flexible(version);
89 let mut out = Self::default();
90 if version >= 0 {
91 out.throttle_time_ms = get_i32(buf)?;
92 }
93 if version >= 0 {
94 out.groups = {
95 let n = crate::primitives::array::get_array_len(buf, flex)?;
96 let mut v = Vec::with_capacity(n);
97 for _ in 0..n {
98 v.push(DescribedGroup::decode(buf, version)?);
99 }
100 v
101 };
102 }
103 if flex {
104 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
105 }
106 Ok(out)
107 }
108}
109#[cfg(test)]
110impl StreamsGroupDescribeResponse {
111 #[must_use]
112 pub fn populated(version: i16) -> Self {
113 let mut m = Self::default();
114 if version >= 0 {
115 m.throttle_time_ms = 1i32;
116 }
117 if version >= 0 {
118 m.groups = vec![DescribedGroup::populated(version)];
119 }
120 m
121 }
122}
123#[derive(Debug, Clone, PartialEq, Eq)]
124pub struct DescribedGroup {
125 pub error_code: i16,
126 pub error_message: Option<String>,
127 pub group_id: String,
128 pub group_state: String,
129 pub group_epoch: i32,
130 pub assignment_epoch: i32,
131 pub topology: Option<Topology>,
132 pub members: Vec<Member>,
133 pub authorized_operations: i32,
134 pub topology_description: Option<
135 super::common::streams_group_describe_response::topology_description::TopologyDescription,
136 >,
137 pub topology_description_status: i8,
138 pub assignor_name: Option<String>,
139 pub unknown_tagged_fields: UnknownTaggedFields,
140}
141impl Default for DescribedGroup {
142 fn default() -> Self {
143 Self {
144 error_code: 0i16,
145 error_message: None,
146 group_id: String::new(),
147 group_state: String::new(),
148 group_epoch: 0i32,
149 assignment_epoch: 0i32,
150 topology: None,
151 members: Vec::new(),
152 authorized_operations: -2_147_483_648i32,
153 topology_description: None,
154 topology_description_status: 0i8,
155 assignor_name: None,
156 unknown_tagged_fields: UnknownTaggedFields::default(),
157 }
158 }
159}
160impl DescribedGroup {
161 fn encode_field_0<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
162 if version >= 0 {
163 put_i16(buf, self.error_code);
164 }
165 }
166 fn encode_field_1<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
167 if version >= 0 {
168 if flex {
169 let () = put_compact_nullable_string(buf, self.error_message.as_deref());
170 } else {
171 let () = put_nullable_string(buf, self.error_message.as_deref());
172 }
173 }
174 }
175 fn encode_field_2<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
176 if version >= 0 {
177 if flex {
178 let () = put_compact_string(buf, &self.group_id);
179 } else {
180 let () = put_string(buf, &self.group_id);
181 }
182 }
183 }
184 fn encode_field_3<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
185 if version >= 0 {
186 if flex {
187 let () = put_compact_string(buf, &self.group_state);
188 } else {
189 let () = put_string(buf, &self.group_state);
190 }
191 }
192 }
193 fn encode_field_4<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
194 if version >= 0 {
195 put_i32(buf, self.group_epoch);
196 }
197 }
198 fn encode_field_5<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
199 if version >= 0 {
200 put_i32(buf, self.assignment_epoch);
201 }
202 }
203 fn encode_field_6<B: BufMut>(
204 &self,
205 buf: &mut B,
206 version: i16,
207 _flex: bool,
208 ) -> Result<(), ProtocolError> {
209 if version >= 0 {
210 match &self.topology {
211 None => {
212 buf.put_i8(-1);
213 }
214 Some(v) => {
215 buf.put_i8(1);
216 v.encode(buf, version)?;
217 }
218 }
219 }
220 Ok(())
221 }
222 fn encode_field_7<B: BufMut>(
223 &self,
224 buf: &mut B,
225 version: i16,
226 flex: bool,
227 ) -> Result<(), ProtocolError> {
228 if version >= 0 {
229 {
230 crate::primitives::array::put_array_len(buf, (self.members).len(), flex);
231 for it in &self.members {
232 it.encode(buf, version)?;
233 }
234 };
235 }
236 Ok(())
237 }
238 fn encode_field_8<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
239 if version >= 0 {
240 put_i32(buf, self.authorized_operations);
241 }
242 }
243 fn encode_field_9<B: BufMut>(
244 &self,
245 buf: &mut B,
246 version: i16,
247 _flex: bool,
248 ) -> Result<(), ProtocolError> {
249 if version >= 1 {
250 match &self.topology_description {
251 None => {
252 buf.put_i8(-1);
253 }
254 Some(v) => {
255 buf.put_i8(1);
256 v.encode(buf, version)?;
257 }
258 }
259 }
260 Ok(())
261 }
262 fn encode_field_10<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
263 if version >= 1 {
264 put_i8(buf, self.topology_description_status);
265 }
266 }
267 fn encode_field_11<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
268 if version >= 1 {
269 if flex {
270 let () = put_compact_nullable_string(buf, self.assignor_name.as_deref());
271 } else {
272 let () = put_nullable_string(buf, self.assignor_name.as_deref());
273 }
274 }
275 }
276 fn encode_tagged_fields<B: BufMut>(&self, buf: &mut B, _version: i16, flex: bool) {
277 if flex {
278 let tagged = WriteTaggedFields::new();
279 tagged.write(buf, &self.unknown_tagged_fields);
280 }
281 }
282 fn decode_field_0<B: Buf>(
283 out: &mut Self,
284 buf: &mut B,
285 version: i16,
286 _flex: bool,
287 ) -> Result<(), ProtocolError> {
288 if version >= 0 {
289 out.error_code = get_i16(buf)?;
290 }
291 Ok(())
292 }
293 fn decode_field_1<B: Buf>(
294 out: &mut Self,
295 buf: &mut B,
296 version: i16,
297 flex: bool,
298 ) -> Result<(), ProtocolError> {
299 if version >= 0 {
300 out.error_message = if flex {
301 get_compact_nullable_string_owned(buf)?
302 } else {
303 get_nullable_string_owned(buf)?
304 };
305 }
306 Ok(())
307 }
308 fn decode_field_2<B: Buf>(
309 out: &mut Self,
310 buf: &mut B,
311 version: i16,
312 flex: bool,
313 ) -> Result<(), ProtocolError> {
314 if version >= 0 {
315 out.group_id = if flex {
316 get_compact_string_owned(buf)?
317 } else {
318 get_string_owned(buf)?
319 };
320 }
321 Ok(())
322 }
323 fn decode_field_3<B: Buf>(
324 out: &mut Self,
325 buf: &mut B,
326 version: i16,
327 flex: bool,
328 ) -> Result<(), ProtocolError> {
329 if version >= 0 {
330 out.group_state = if flex {
331 get_compact_string_owned(buf)?
332 } else {
333 get_string_owned(buf)?
334 };
335 }
336 Ok(())
337 }
338 fn decode_field_4<B: Buf>(
339 out: &mut Self,
340 buf: &mut B,
341 version: i16,
342 _flex: bool,
343 ) -> Result<(), ProtocolError> {
344 if version >= 0 {
345 out.group_epoch = get_i32(buf)?;
346 }
347 Ok(())
348 }
349 fn decode_field_5<B: Buf>(
350 out: &mut Self,
351 buf: &mut B,
352 version: i16,
353 _flex: bool,
354 ) -> Result<(), ProtocolError> {
355 if version >= 0 {
356 out.assignment_epoch = get_i32(buf)?;
357 }
358 Ok(())
359 }
360 fn decode_field_6<B: Buf>(
361 out: &mut Self,
362 buf: &mut B,
363 version: i16,
364 _flex: bool,
365 ) -> Result<(), ProtocolError> {
366 if version >= 0 {
367 out.topology = if get_i8(buf)? < 0 {
368 None
369 } else {
370 Some(Topology::decode(buf, version)?)
371 };
372 }
373 Ok(())
374 }
375 fn decode_field_7<B: Buf>(
376 out: &mut Self,
377 buf: &mut B,
378 version: i16,
379 flex: bool,
380 ) -> Result<(), ProtocolError> {
381 if version >= 0 {
382 out.members = {
383 let n = crate::primitives::array::get_array_len(buf, flex)?;
384 let mut v = Vec::with_capacity(n);
385 for _ in 0..n {
386 v.push(Member::decode(buf, version)?);
387 }
388 v
389 };
390 }
391 Ok(())
392 }
393 fn decode_field_8<B: Buf>(
394 out: &mut Self,
395 buf: &mut B,
396 version: i16,
397 _flex: bool,
398 ) -> Result<(), ProtocolError> {
399 if version >= 0 {
400 out.authorized_operations = get_i32(buf)?;
401 }
402 Ok(())
403 }
404 fn decode_field_9<B: Buf>(
405 out: &mut Self,
406 buf: &mut B,
407 version: i16,
408 _flex: bool,
409 ) -> Result<(), ProtocolError> {
410 if version >= 1 {
411 out.topology_description = if get_i8(buf)? < 0 {
412 None
413 } else {
414 Some(super::common::streams_group_describe_response::topology_description::TopologyDescription::decode(buf, version)?)
415 };
416 }
417 Ok(())
418 }
419 fn decode_field_10<B: Buf>(
420 out: &mut Self,
421 buf: &mut B,
422 version: i16,
423 _flex: bool,
424 ) -> Result<(), ProtocolError> {
425 if version >= 1 {
426 out.topology_description_status = get_i8(buf)?;
427 }
428 Ok(())
429 }
430 fn decode_field_11<B: Buf>(
431 out: &mut Self,
432 buf: &mut B,
433 version: i16,
434 flex: bool,
435 ) -> Result<(), ProtocolError> {
436 if version >= 1 {
437 out.assignor_name = if flex {
438 get_compact_nullable_string_owned(buf)?
439 } else {
440 get_nullable_string_owned(buf)?
441 };
442 }
443 Ok(())
444 }
445 fn decode_tagged_fields<B: Buf>(
446 out: &mut Self,
447 buf: &mut B,
448 _version: i16,
449 flex: bool,
450 ) -> Result<(), ProtocolError> {
451 if flex {
452 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
453 }
454 Ok(())
455 }
456}
457impl Encode for DescribedGroup {
458 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
459 let flex = version >= 0;
460 self.encode_field_0(buf, version, flex);
461 self.encode_field_1(buf, version, flex);
462 self.encode_field_2(buf, version, flex);
463 self.encode_field_3(buf, version, flex);
464 self.encode_field_4(buf, version, flex);
465 self.encode_field_5(buf, version, flex);
466 self.encode_field_6(buf, version, flex)?;
467 self.encode_field_7(buf, version, flex)?;
468 self.encode_field_8(buf, version, flex);
469 self.encode_field_9(buf, version, flex)?;
470 self.encode_field_10(buf, version, flex);
471 self.encode_field_11(buf, version, flex);
472 self.encode_tagged_fields(buf, version, flex);
473 Ok(())
474 }
475 fn encoded_len(&self, version: i16) -> usize {
476 let flex = version >= 0;
477 let mut n: usize = 0;
478 if version >= 0 {
479 n += 2;
480 }
481 if version >= 0 {
482 n += if flex {
483 compact_nullable_string_len(self.error_message.as_deref())
484 } else {
485 nullable_string_len(self.error_message.as_deref())
486 };
487 }
488 if version >= 0 {
489 n += if flex {
490 compact_string_len(&self.group_id)
491 } else {
492 string_len(&self.group_id)
493 };
494 }
495 if version >= 0 {
496 n += if flex {
497 compact_string_len(&self.group_state)
498 } else {
499 string_len(&self.group_state)
500 };
501 }
502 if version >= 0 {
503 n += 4;
504 }
505 if version >= 0 {
506 n += 4;
507 }
508 if version >= 0 {
509 n += 1 + self.topology.as_ref().map_or(0, |v| v.encoded_len(version));
510 }
511 if version >= 0 {
512 n += {
513 let prefix =
514 crate::primitives::array::array_len_prefix_len((self.members).len(), flex);
515 let body: usize = (self.members)
516 .iter()
517 .map(|it| it.encoded_len(version))
518 .sum();
519 prefix + body
520 };
521 }
522 if version >= 0 {
523 n += 4;
524 }
525 if version >= 1 {
526 n += 1 + self
527 .topology_description
528 .as_ref()
529 .map_or(0, |v| v.encoded_len(version));
530 }
531 if version >= 1 {
532 n += 1;
533 }
534 if version >= 1 {
535 n += if flex {
536 compact_nullable_string_len(self.assignor_name.as_deref())
537 } else {
538 nullable_string_len(self.assignor_name.as_deref())
539 };
540 }
541 if flex {
542 let known_pairs: Vec<(u32, usize)> = Vec::new();
543 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
544 }
545 n
546 }
547}
548impl Decode<'_> for DescribedGroup {
549 fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
550 let flex = version >= 0;
551 let mut out = Self::default();
552 Self::decode_field_0(&mut out, buf, version, flex)?;
553 Self::decode_field_1(&mut out, buf, version, flex)?;
554 Self::decode_field_2(&mut out, buf, version, flex)?;
555 Self::decode_field_3(&mut out, buf, version, flex)?;
556 Self::decode_field_4(&mut out, buf, version, flex)?;
557 Self::decode_field_5(&mut out, buf, version, flex)?;
558 Self::decode_field_6(&mut out, buf, version, flex)?;
559 Self::decode_field_7(&mut out, buf, version, flex)?;
560 Self::decode_field_8(&mut out, buf, version, flex)?;
561 Self::decode_field_9(&mut out, buf, version, flex)?;
562 Self::decode_field_10(&mut out, buf, version, flex)?;
563 Self::decode_field_11(&mut out, buf, version, flex)?;
564 Self::decode_tagged_fields(&mut out, buf, version, flex)?;
565 Ok(out)
566 }
567}
568#[cfg(test)]
569impl DescribedGroup {
570 #[must_use]
571 pub fn populated(version: i16) -> Self {
572 let mut m = Self::default();
573 if version >= 0 {
574 m.error_code = 1i16;
575 }
576 if version >= 0 {
577 m.error_message = Some("x".to_string());
578 }
579 if version >= 0 {
580 m.group_id = "x".to_string();
581 }
582 if version >= 0 {
583 m.group_state = "x".to_string();
584 }
585 if version >= 0 {
586 m.group_epoch = 1i32;
587 }
588 if version >= 0 {
589 m.assignment_epoch = 1i32;
590 }
591 if version >= 0 {
592 m.topology = Some(Topology::populated(version));
593 }
594 if version >= 0 {
595 m.members = vec![Member::populated(version)];
596 }
597 if version >= 0 {
598 m.authorized_operations = 1i32;
599 }
600 if version >= 1 {
601 m.topology_description = Some(super::common::streams_group_describe_response::topology_description::TopologyDescription::populated(version));
602 }
603 if version >= 1 {
604 m.topology_description_status = 1i8;
605 }
606 if version >= 1 {
607 m.assignor_name = Some("x".to_string());
608 }
609 m
610 }
611}
612#[derive(Debug, Clone, PartialEq, Eq, Default)]
613pub struct Topology {
614 pub epoch: i32,
615 pub subtopologies: Option<Vec<Subtopology>>,
616 pub unknown_tagged_fields: UnknownTaggedFields,
617}
618impl Encode for Topology {
619 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
620 let flex = version >= 0;
621 if version >= 0 {
622 put_i32(buf, self.epoch);
623 }
624 if version >= 0 {
625 {
626 let len = (self.subtopologies).as_ref().map(Vec::len);
627 crate::primitives::array::put_nullable_array_len(buf, len, flex);
628 if let Some(v) = &self.subtopologies {
629 for it in v {
630 it.encode(buf, version)?;
631 }
632 }
633 };
634 }
635 if flex {
636 let tagged = WriteTaggedFields::new();
637 tagged.write(buf, &self.unknown_tagged_fields);
638 }
639 Ok(())
640 }
641 fn encoded_len(&self, version: i16) -> usize {
642 let flex = version >= 0;
643 let mut n: usize = 0;
644 if version >= 0 {
645 n += 4;
646 }
647 if version >= 0 {
648 n += {
649 let opt: Option<&Vec<_>> = (self.subtopologies).as_ref();
650 let prefix = crate::primitives::array::nullable_array_len_prefix_len(
651 opt.map(std::vec::Vec::len),
652 flex,
653 );
654 let body: usize =
655 opt.map_or(0, |v| v.iter().map(|it| it.encoded_len(version)).sum());
656 prefix + body
657 };
658 }
659 if flex {
660 let known_pairs: Vec<(u32, usize)> = Vec::new();
661 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
662 }
663 n
664 }
665}
666impl Decode<'_> for Topology {
667 fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
668 let flex = version >= 0;
669 let mut out = Self::default();
670 if version >= 0 {
671 out.epoch = get_i32(buf)?;
672 }
673 if version >= 0 {
674 out.subtopologies = {
675 let opt = crate::primitives::array::get_nullable_array_len(buf, flex)?;
676 match opt {
677 None => None,
678 Some(n) => {
679 let mut v = Vec::with_capacity(n);
680 for _ in 0..n {
681 v.push(Subtopology::decode(buf, version)?);
682 }
683 Some(v)
684 }
685 }
686 };
687 }
688 if flex {
689 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
690 }
691 Ok(out)
692 }
693}
694#[cfg(test)]
695impl Topology {
696 #[must_use]
697 pub fn populated(version: i16) -> Self {
698 let mut m = Self::default();
699 if version >= 0 {
700 m.epoch = 1i32;
701 }
702 if version >= 0 {
703 m.subtopologies = Some(vec![Subtopology::populated(version)]);
704 }
705 m
706 }
707}
708#[derive(Debug, Clone, PartialEq, Eq, Default)]
709pub struct Subtopology {
710 pub subtopology_id: String,
711 pub source_topics: Vec<String>,
712 pub repartition_sink_topics: Vec<String>,
713 pub state_changelog_topics:
714 Vec<super::common::streams_group_describe_response::topic_info::TopicInfo>,
715 pub repartition_source_topics:
716 Vec<super::common::streams_group_describe_response::topic_info::TopicInfo>,
717 pub unknown_tagged_fields: UnknownTaggedFields,
718}
719impl Encode for Subtopology {
720 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
721 let flex = version >= 0;
722 if version >= 0 {
723 if flex {
724 let () = put_compact_string(buf, &self.subtopology_id);
725 } else {
726 let () = put_string(buf, &self.subtopology_id);
727 }
728 }
729 if version >= 0 {
730 {
731 crate::primitives::array::put_array_len(buf, (self.source_topics).len(), flex);
732 for it in &self.source_topics {
733 if flex {
734 let () = put_compact_string(buf, it);
735 } else {
736 let () = put_string(buf, it);
737 }
738 }
739 };
740 }
741 if version >= 0 {
742 {
743 crate::primitives::array::put_array_len(
744 buf,
745 (self.repartition_sink_topics).len(),
746 flex,
747 );
748 for it in &self.repartition_sink_topics {
749 if flex {
750 let () = put_compact_string(buf, it);
751 } else {
752 let () = put_string(buf, it);
753 }
754 }
755 };
756 }
757 if version >= 0 {
758 {
759 crate::primitives::array::put_array_len(
760 buf,
761 (self.state_changelog_topics).len(),
762 flex,
763 );
764 for it in &self.state_changelog_topics {
765 it.encode(buf, version)?;
766 }
767 };
768 }
769 if version >= 0 {
770 {
771 crate::primitives::array::put_array_len(
772 buf,
773 (self.repartition_source_topics).len(),
774 flex,
775 );
776 for it in &self.repartition_source_topics {
777 it.encode(buf, version)?;
778 }
779 };
780 }
781 if flex {
782 let tagged = WriteTaggedFields::new();
783 tagged.write(buf, &self.unknown_tagged_fields);
784 }
785 Ok(())
786 }
787 fn encoded_len(&self, version: i16) -> usize {
788 let flex = version >= 0;
789 let mut n: usize = 0;
790 if version >= 0 {
791 n += if flex {
792 compact_string_len(&self.subtopology_id)
793 } else {
794 string_len(&self.subtopology_id)
795 };
796 }
797 if version >= 0 {
798 n += {
799 let prefix = crate::primitives::array::array_len_prefix_len(
800 (self.source_topics).len(),
801 flex,
802 );
803 let body: usize = (self.source_topics)
804 .iter()
805 .map(|it| {
806 if flex {
807 compact_string_len(it)
808 } else {
809 string_len(it)
810 }
811 })
812 .sum();
813 prefix + body
814 };
815 }
816 if version >= 0 {
817 n += {
818 let prefix = crate::primitives::array::array_len_prefix_len(
819 (self.repartition_sink_topics).len(),
820 flex,
821 );
822 let body: usize = (self.repartition_sink_topics)
823 .iter()
824 .map(|it| {
825 if flex {
826 compact_string_len(it)
827 } else {
828 string_len(it)
829 }
830 })
831 .sum();
832 prefix + body
833 };
834 }
835 if version >= 0 {
836 n += {
837 let prefix = crate::primitives::array::array_len_prefix_len(
838 (self.state_changelog_topics).len(),
839 flex,
840 );
841 let body: usize = (self.state_changelog_topics)
842 .iter()
843 .map(|it| it.encoded_len(version))
844 .sum();
845 prefix + body
846 };
847 }
848 if version >= 0 {
849 n += {
850 let prefix = crate::primitives::array::array_len_prefix_len(
851 (self.repartition_source_topics).len(),
852 flex,
853 );
854 let body: usize = (self.repartition_source_topics)
855 .iter()
856 .map(|it| it.encoded_len(version))
857 .sum();
858 prefix + body
859 };
860 }
861 if flex {
862 let known_pairs: Vec<(u32, usize)> = Vec::new();
863 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
864 }
865 n
866 }
867}
868impl Decode<'_> for Subtopology {
869 fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
870 let flex = version >= 0;
871 let mut out = Self::default();
872 if version >= 0 {
873 out.subtopology_id = if flex {
874 get_compact_string_owned(buf)?
875 } else {
876 get_string_owned(buf)?
877 };
878 }
879 if version >= 0 {
880 out.source_topics = {
881 let n = crate::primitives::array::get_array_len(buf, flex)?;
882 let mut v = Vec::with_capacity(n);
883 for _ in 0..n {
884 v.push(if flex {
885 get_compact_string_owned(buf)?
886 } else {
887 get_string_owned(buf)?
888 });
889 }
890 v
891 };
892 }
893 if version >= 0 {
894 out.repartition_sink_topics = {
895 let n = crate::primitives::array::get_array_len(buf, flex)?;
896 let mut v = Vec::with_capacity(n);
897 for _ in 0..n {
898 v.push(if flex {
899 get_compact_string_owned(buf)?
900 } else {
901 get_string_owned(buf)?
902 });
903 }
904 v
905 };
906 }
907 if version >= 0 {
908 out.state_changelog_topics = {
909 let n = crate::primitives::array::get_array_len(buf, flex)?;
910 let mut v = Vec::with_capacity(n);
911 for _ in 0..n {
912 v.push(super::common::streams_group_describe_response::topic_info::TopicInfo::decode(buf, version)?);
913 }
914 v
915 };
916 }
917 if version >= 0 {
918 out.repartition_source_topics = {
919 let n = crate::primitives::array::get_array_len(buf, flex)?;
920 let mut v = Vec::with_capacity(n);
921 for _ in 0..n {
922 v.push(super::common::streams_group_describe_response::topic_info::TopicInfo::decode(buf, version)?);
923 }
924 v
925 };
926 }
927 if flex {
928 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
929 }
930 Ok(out)
931 }
932}
933#[cfg(test)]
934impl Subtopology {
935 #[must_use]
936 pub fn populated(version: i16) -> Self {
937 let mut m = Self::default();
938 if version >= 0 {
939 m.subtopology_id = "x".to_string();
940 }
941 if version >= 0 {
942 m.source_topics = vec!["x".to_string()];
943 }
944 if version >= 0 {
945 m.repartition_sink_topics = vec!["x".to_string()];
946 }
947 if version >= 0 {
948 m.state_changelog_topics = vec![
949 super::common::streams_group_describe_response::topic_info::TopicInfo::populated(
950 version,
951 ),
952 ];
953 }
954 if version >= 0 {
955 m.repartition_source_topics = vec![
956 super::common::streams_group_describe_response::topic_info::TopicInfo::populated(
957 version,
958 ),
959 ];
960 }
961 m
962 }
963}
964#[derive(Debug, Clone, PartialEq, Eq, Default)]
965pub struct Member {
966 pub member_id: String,
967 pub member_epoch: i32,
968 pub instance_id: Option<String>,
969 pub rack_id: Option<String>,
970 pub client_id: String,
971 pub client_host: String,
972 pub topology_epoch: i32,
973 pub process_id: String,
974 pub user_endpoint: Option<super::common::streams_group_describe_response::endpoint::Endpoint>,
975 pub client_tags: Vec<super::common::streams_group_describe_response::key_value::KeyValue>,
976 pub task_offsets: Vec<super::common::streams_group_describe_response::task_offset::TaskOffset>,
977 pub task_end_offsets:
978 Vec<super::common::streams_group_describe_response::task_offset::TaskOffset>,
979 pub assignment: super::common::streams_group_describe_response::assignment::Assignment,
980 pub target_assignment: super::common::streams_group_describe_response::assignment::Assignment,
981 pub is_classic: bool,
982 pub unknown_tagged_fields: UnknownTaggedFields,
983}
984impl Member {
985 fn encode_field_0<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
986 if version >= 0 {
987 if flex {
988 let () = put_compact_string(buf, &self.member_id);
989 } else {
990 let () = put_string(buf, &self.member_id);
991 }
992 }
993 }
994 fn encode_field_1<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
995 if version >= 0 {
996 put_i32(buf, self.member_epoch);
997 }
998 }
999 fn encode_field_2<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
1000 if version >= 0 {
1001 if flex {
1002 let () = put_compact_nullable_string(buf, self.instance_id.as_deref());
1003 } else {
1004 let () = put_nullable_string(buf, self.instance_id.as_deref());
1005 }
1006 }
1007 }
1008 fn encode_field_3<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
1009 if version >= 0 {
1010 if flex {
1011 let () = put_compact_nullable_string(buf, self.rack_id.as_deref());
1012 } else {
1013 let () = put_nullable_string(buf, self.rack_id.as_deref());
1014 }
1015 }
1016 }
1017 fn encode_field_4<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
1018 if version >= 0 {
1019 if flex {
1020 let () = put_compact_string(buf, &self.client_id);
1021 } else {
1022 let () = put_string(buf, &self.client_id);
1023 }
1024 }
1025 }
1026 fn encode_field_5<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
1027 if version >= 0 {
1028 if flex {
1029 let () = put_compact_string(buf, &self.client_host);
1030 } else {
1031 let () = put_string(buf, &self.client_host);
1032 }
1033 }
1034 }
1035 fn encode_field_6<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
1036 if version >= 0 {
1037 put_i32(buf, self.topology_epoch);
1038 }
1039 }
1040 fn encode_field_7<B: BufMut>(&self, buf: &mut B, version: i16, flex: bool) {
1041 if version >= 0 {
1042 if flex {
1043 let () = put_compact_string(buf, &self.process_id);
1044 } else {
1045 let () = put_string(buf, &self.process_id);
1046 }
1047 }
1048 }
1049 fn encode_field_8<B: BufMut>(
1050 &self,
1051 buf: &mut B,
1052 version: i16,
1053 _flex: bool,
1054 ) -> Result<(), ProtocolError> {
1055 if version >= 0 {
1056 match &self.user_endpoint {
1057 None => {
1058 buf.put_i8(-1);
1059 }
1060 Some(v) => {
1061 buf.put_i8(1);
1062 v.encode(buf, version)?;
1063 }
1064 }
1065 }
1066 Ok(())
1067 }
1068 fn encode_field_9<B: BufMut>(
1069 &self,
1070 buf: &mut B,
1071 version: i16,
1072 flex: bool,
1073 ) -> Result<(), ProtocolError> {
1074 if version >= 0 {
1075 {
1076 crate::primitives::array::put_array_len(buf, (self.client_tags).len(), flex);
1077 for it in &self.client_tags {
1078 it.encode(buf, version)?;
1079 }
1080 };
1081 }
1082 Ok(())
1083 }
1084 fn encode_field_10<B: BufMut>(
1085 &self,
1086 buf: &mut B,
1087 version: i16,
1088 flex: bool,
1089 ) -> Result<(), ProtocolError> {
1090 if version >= 0 {
1091 {
1092 crate::primitives::array::put_array_len(buf, (self.task_offsets).len(), flex);
1093 for it in &self.task_offsets {
1094 it.encode(buf, version)?;
1095 }
1096 };
1097 }
1098 Ok(())
1099 }
1100 fn encode_field_11<B: BufMut>(
1101 &self,
1102 buf: &mut B,
1103 version: i16,
1104 flex: bool,
1105 ) -> Result<(), ProtocolError> {
1106 if version >= 0 {
1107 {
1108 crate::primitives::array::put_array_len(buf, (self.task_end_offsets).len(), flex);
1109 for it in &self.task_end_offsets {
1110 it.encode(buf, version)?;
1111 }
1112 };
1113 }
1114 Ok(())
1115 }
1116 fn encode_field_12<B: BufMut>(
1117 &self,
1118 buf: &mut B,
1119 version: i16,
1120 _flex: bool,
1121 ) -> Result<(), ProtocolError> {
1122 if version >= 0 {
1123 self.assignment.encode(buf, version)?;
1124 }
1125 Ok(())
1126 }
1127 fn encode_field_13<B: BufMut>(
1128 &self,
1129 buf: &mut B,
1130 version: i16,
1131 _flex: bool,
1132 ) -> Result<(), ProtocolError> {
1133 if version >= 0 {
1134 self.target_assignment.encode(buf, version)?;
1135 }
1136 Ok(())
1137 }
1138 fn encode_field_14<B: BufMut>(&self, buf: &mut B, version: i16, _flex: bool) {
1139 if version >= 0 {
1140 put_bool(buf, self.is_classic);
1141 }
1142 }
1143 fn encode_tagged_fields<B: BufMut>(&self, buf: &mut B, _version: i16, flex: bool) {
1144 if flex {
1145 let tagged = WriteTaggedFields::new();
1146 tagged.write(buf, &self.unknown_tagged_fields);
1147 }
1148 }
1149 fn decode_field_0<B: Buf>(
1150 out: &mut Self,
1151 buf: &mut B,
1152 version: i16,
1153 flex: bool,
1154 ) -> Result<(), ProtocolError> {
1155 if version >= 0 {
1156 out.member_id = if flex {
1157 get_compact_string_owned(buf)?
1158 } else {
1159 get_string_owned(buf)?
1160 };
1161 }
1162 Ok(())
1163 }
1164 fn decode_field_1<B: Buf>(
1165 out: &mut Self,
1166 buf: &mut B,
1167 version: i16,
1168 _flex: bool,
1169 ) -> Result<(), ProtocolError> {
1170 if version >= 0 {
1171 out.member_epoch = get_i32(buf)?;
1172 }
1173 Ok(())
1174 }
1175 fn decode_field_2<B: Buf>(
1176 out: &mut Self,
1177 buf: &mut B,
1178 version: i16,
1179 flex: bool,
1180 ) -> Result<(), ProtocolError> {
1181 if version >= 0 {
1182 out.instance_id = if flex {
1183 get_compact_nullable_string_owned(buf)?
1184 } else {
1185 get_nullable_string_owned(buf)?
1186 };
1187 }
1188 Ok(())
1189 }
1190 fn decode_field_3<B: Buf>(
1191 out: &mut Self,
1192 buf: &mut B,
1193 version: i16,
1194 flex: bool,
1195 ) -> Result<(), ProtocolError> {
1196 if version >= 0 {
1197 out.rack_id = if flex {
1198 get_compact_nullable_string_owned(buf)?
1199 } else {
1200 get_nullable_string_owned(buf)?
1201 };
1202 }
1203 Ok(())
1204 }
1205 fn decode_field_4<B: Buf>(
1206 out: &mut Self,
1207 buf: &mut B,
1208 version: i16,
1209 flex: bool,
1210 ) -> Result<(), ProtocolError> {
1211 if version >= 0 {
1212 out.client_id = if flex {
1213 get_compact_string_owned(buf)?
1214 } else {
1215 get_string_owned(buf)?
1216 };
1217 }
1218 Ok(())
1219 }
1220 fn decode_field_5<B: Buf>(
1221 out: &mut Self,
1222 buf: &mut B,
1223 version: i16,
1224 flex: bool,
1225 ) -> Result<(), ProtocolError> {
1226 if version >= 0 {
1227 out.client_host = if flex {
1228 get_compact_string_owned(buf)?
1229 } else {
1230 get_string_owned(buf)?
1231 };
1232 }
1233 Ok(())
1234 }
1235 fn decode_field_6<B: Buf>(
1236 out: &mut Self,
1237 buf: &mut B,
1238 version: i16,
1239 _flex: bool,
1240 ) -> Result<(), ProtocolError> {
1241 if version >= 0 {
1242 out.topology_epoch = get_i32(buf)?;
1243 }
1244 Ok(())
1245 }
1246 fn decode_field_7<B: Buf>(
1247 out: &mut Self,
1248 buf: &mut B,
1249 version: i16,
1250 flex: bool,
1251 ) -> Result<(), ProtocolError> {
1252 if version >= 0 {
1253 out.process_id = if flex {
1254 get_compact_string_owned(buf)?
1255 } else {
1256 get_string_owned(buf)?
1257 };
1258 }
1259 Ok(())
1260 }
1261 fn decode_field_8<B: Buf>(
1262 out: &mut Self,
1263 buf: &mut B,
1264 version: i16,
1265 _flex: bool,
1266 ) -> Result<(), ProtocolError> {
1267 if version >= 0 {
1268 out.user_endpoint = if get_i8(buf)? < 0 {
1269 None
1270 } else {
1271 Some(
1272 super::common::streams_group_describe_response::endpoint::Endpoint::decode(
1273 buf, version,
1274 )?,
1275 )
1276 };
1277 }
1278 Ok(())
1279 }
1280 fn decode_field_9<B: Buf>(
1281 out: &mut Self,
1282 buf: &mut B,
1283 version: i16,
1284 flex: bool,
1285 ) -> Result<(), ProtocolError> {
1286 if version >= 0 {
1287 out.client_tags = {
1288 let n = crate::primitives::array::get_array_len(buf, flex)?;
1289 let mut v = Vec::with_capacity(n);
1290 for _ in 0..n {
1291 v.push(super::common::streams_group_describe_response::key_value::KeyValue::decode(buf, version)?);
1292 }
1293 v
1294 };
1295 }
1296 Ok(())
1297 }
1298 fn decode_field_10<B: Buf>(
1299 out: &mut Self,
1300 buf: &mut B,
1301 version: i16,
1302 flex: bool,
1303 ) -> Result<(), ProtocolError> {
1304 if version >= 0 {
1305 out.task_offsets = {
1306 let n = crate::primitives::array::get_array_len(buf, flex)?;
1307 let mut v = Vec::with_capacity(n);
1308 for _ in 0..n {
1309 v.push(super::common::streams_group_describe_response::task_offset::TaskOffset::decode(buf, version)?);
1310 }
1311 v
1312 };
1313 }
1314 Ok(())
1315 }
1316 fn decode_field_11<B: Buf>(
1317 out: &mut Self,
1318 buf: &mut B,
1319 version: i16,
1320 flex: bool,
1321 ) -> Result<(), ProtocolError> {
1322 if version >= 0 {
1323 out.task_end_offsets = {
1324 let n = crate::primitives::array::get_array_len(buf, flex)?;
1325 let mut v = Vec::with_capacity(n);
1326 for _ in 0..n {
1327 v.push(super::common::streams_group_describe_response::task_offset::TaskOffset::decode(buf, version)?);
1328 }
1329 v
1330 };
1331 }
1332 Ok(())
1333 }
1334 fn decode_field_12<B: Buf>(
1335 out: &mut Self,
1336 buf: &mut B,
1337 version: i16,
1338 _flex: bool,
1339 ) -> Result<(), ProtocolError> {
1340 if version >= 0 {
1341 out.assignment =
1342 super::common::streams_group_describe_response::assignment::Assignment::decode(
1343 buf, version,
1344 )?;
1345 }
1346 Ok(())
1347 }
1348 fn decode_field_13<B: Buf>(
1349 out: &mut Self,
1350 buf: &mut B,
1351 version: i16,
1352 _flex: bool,
1353 ) -> Result<(), ProtocolError> {
1354 if version >= 0 {
1355 out.target_assignment =
1356 super::common::streams_group_describe_response::assignment::Assignment::decode(
1357 buf, version,
1358 )?;
1359 }
1360 Ok(())
1361 }
1362 fn decode_field_14<B: Buf>(
1363 out: &mut Self,
1364 buf: &mut B,
1365 version: i16,
1366 _flex: bool,
1367 ) -> Result<(), ProtocolError> {
1368 if version >= 0 {
1369 out.is_classic = get_bool(buf)?;
1370 }
1371 Ok(())
1372 }
1373 fn decode_tagged_fields<B: Buf>(
1374 out: &mut Self,
1375 buf: &mut B,
1376 _version: i16,
1377 flex: bool,
1378 ) -> Result<(), ProtocolError> {
1379 if flex {
1380 out.unknown_tagged_fields = read_tagged_fields(buf, |_tag, _payload| Ok(false))?;
1381 }
1382 Ok(())
1383 }
1384}
1385impl Encode for Member {
1386 fn encode<B: BufMut>(&self, buf: &mut B, version: i16) -> Result<(), ProtocolError> {
1387 let flex = version >= 0;
1388 self.encode_field_0(buf, version, flex);
1389 self.encode_field_1(buf, version, flex);
1390 self.encode_field_2(buf, version, flex);
1391 self.encode_field_3(buf, version, flex);
1392 self.encode_field_4(buf, version, flex);
1393 self.encode_field_5(buf, version, flex);
1394 self.encode_field_6(buf, version, flex);
1395 self.encode_field_7(buf, version, flex);
1396 self.encode_field_8(buf, version, flex)?;
1397 self.encode_field_9(buf, version, flex)?;
1398 self.encode_field_10(buf, version, flex)?;
1399 self.encode_field_11(buf, version, flex)?;
1400 self.encode_field_12(buf, version, flex)?;
1401 self.encode_field_13(buf, version, flex)?;
1402 self.encode_field_14(buf, version, flex);
1403 self.encode_tagged_fields(buf, version, flex);
1404 Ok(())
1405 }
1406 fn encoded_len(&self, version: i16) -> usize {
1407 let flex = version >= 0;
1408 let mut n: usize = 0;
1409 if version >= 0 {
1410 n += if flex {
1411 compact_string_len(&self.member_id)
1412 } else {
1413 string_len(&self.member_id)
1414 };
1415 }
1416 if version >= 0 {
1417 n += 4;
1418 }
1419 if version >= 0 {
1420 n += if flex {
1421 compact_nullable_string_len(self.instance_id.as_deref())
1422 } else {
1423 nullable_string_len(self.instance_id.as_deref())
1424 };
1425 }
1426 if version >= 0 {
1427 n += if flex {
1428 compact_nullable_string_len(self.rack_id.as_deref())
1429 } else {
1430 nullable_string_len(self.rack_id.as_deref())
1431 };
1432 }
1433 if version >= 0 {
1434 n += if flex {
1435 compact_string_len(&self.client_id)
1436 } else {
1437 string_len(&self.client_id)
1438 };
1439 }
1440 if version >= 0 {
1441 n += if flex {
1442 compact_string_len(&self.client_host)
1443 } else {
1444 string_len(&self.client_host)
1445 };
1446 }
1447 if version >= 0 {
1448 n += 4;
1449 }
1450 if version >= 0 {
1451 n += if flex {
1452 compact_string_len(&self.process_id)
1453 } else {
1454 string_len(&self.process_id)
1455 };
1456 }
1457 if version >= 0 {
1458 n += 1 + self
1459 .user_endpoint
1460 .as_ref()
1461 .map_or(0, |v| v.encoded_len(version));
1462 }
1463 if version >= 0 {
1464 n += {
1465 let prefix =
1466 crate::primitives::array::array_len_prefix_len((self.client_tags).len(), flex);
1467 let body: usize = (self.client_tags)
1468 .iter()
1469 .map(|it| it.encoded_len(version))
1470 .sum();
1471 prefix + body
1472 };
1473 }
1474 if version >= 0 {
1475 n += {
1476 let prefix =
1477 crate::primitives::array::array_len_prefix_len((self.task_offsets).len(), flex);
1478 let body: usize = (self.task_offsets)
1479 .iter()
1480 .map(|it| it.encoded_len(version))
1481 .sum();
1482 prefix + body
1483 };
1484 }
1485 if version >= 0 {
1486 n += {
1487 let prefix = crate::primitives::array::array_len_prefix_len(
1488 (self.task_end_offsets).len(),
1489 flex,
1490 );
1491 let body: usize = (self.task_end_offsets)
1492 .iter()
1493 .map(|it| it.encoded_len(version))
1494 .sum();
1495 prefix + body
1496 };
1497 }
1498 if version >= 0 {
1499 n += self.assignment.encoded_len(version);
1500 }
1501 if version >= 0 {
1502 n += self.target_assignment.encoded_len(version);
1503 }
1504 if version >= 0 {
1505 n += 1;
1506 }
1507 if flex {
1508 let known_pairs: Vec<(u32, usize)> = Vec::new();
1509 n += tagged_fields_len(&known_pairs, &self.unknown_tagged_fields);
1510 }
1511 n
1512 }
1513}
1514impl Decode<'_> for Member {
1515 fn decode<B: Buf>(buf: &mut B, version: i16) -> Result<Self, ProtocolError> {
1516 let flex = version >= 0;
1517 let mut out = Self::default();
1518 Self::decode_field_0(&mut out, buf, version, flex)?;
1519 Self::decode_field_1(&mut out, buf, version, flex)?;
1520 Self::decode_field_2(&mut out, buf, version, flex)?;
1521 Self::decode_field_3(&mut out, buf, version, flex)?;
1522 Self::decode_field_4(&mut out, buf, version, flex)?;
1523 Self::decode_field_5(&mut out, buf, version, flex)?;
1524 Self::decode_field_6(&mut out, buf, version, flex)?;
1525 Self::decode_field_7(&mut out, buf, version, flex)?;
1526 Self::decode_field_8(&mut out, buf, version, flex)?;
1527 Self::decode_field_9(&mut out, buf, version, flex)?;
1528 Self::decode_field_10(&mut out, buf, version, flex)?;
1529 Self::decode_field_11(&mut out, buf, version, flex)?;
1530 Self::decode_field_12(&mut out, buf, version, flex)?;
1531 Self::decode_field_13(&mut out, buf, version, flex)?;
1532 Self::decode_field_14(&mut out, buf, version, flex)?;
1533 Self::decode_tagged_fields(&mut out, buf, version, flex)?;
1534 Ok(out)
1535 }
1536}
1537#[cfg(test)]
1538impl Member {
1539 #[must_use]
1540 pub fn populated(version: i16) -> Self {
1541 let mut m = Self::default();
1542 if version >= 0 {
1543 m.member_id = "x".to_string();
1544 }
1545 if version >= 0 {
1546 m.member_epoch = 1i32;
1547 }
1548 if version >= 0 {
1549 m.instance_id = Some("x".to_string());
1550 }
1551 if version >= 0 {
1552 m.rack_id = Some("x".to_string());
1553 }
1554 if version >= 0 {
1555 m.client_id = "x".to_string();
1556 }
1557 if version >= 0 {
1558 m.client_host = "x".to_string();
1559 }
1560 if version >= 0 {
1561 m.topology_epoch = 1i32;
1562 }
1563 if version >= 0 {
1564 m.process_id = "x".to_string();
1565 }
1566 if version >= 0 {
1567 m.user_endpoint = Some(
1568 super::common::streams_group_describe_response::endpoint::Endpoint::populated(
1569 version,
1570 ),
1571 );
1572 }
1573 if version >= 0 {
1574 m.client_tags = vec![
1575 super::common::streams_group_describe_response::key_value::KeyValue::populated(
1576 version,
1577 ),
1578 ];
1579 }
1580 if version >= 0 {
1581 m.task_offsets = vec![
1582 super::common::streams_group_describe_response::task_offset::TaskOffset::populated(
1583 version,
1584 ),
1585 ];
1586 }
1587 if version >= 0 {
1588 m.task_end_offsets = vec![
1589 super::common::streams_group_describe_response::task_offset::TaskOffset::populated(
1590 version,
1591 ),
1592 ];
1593 }
1594 if version >= 0 {
1595 m.assignment =
1596 super::common::streams_group_describe_response::assignment::Assignment::populated(
1597 version,
1598 );
1599 }
1600 if version >= 0 {
1601 m.target_assignment =
1602 super::common::streams_group_describe_response::assignment::Assignment::populated(
1603 version,
1604 );
1605 }
1606 if version >= 0 {
1607 m.is_classic = true;
1608 }
1609 m
1610 }
1611}
1612#[must_use]
1615#[allow(unused_comparisons)]
1616pub fn default_json(_version: i16) -> ::serde_json::Value {
1617 let mut obj = ::serde_json::Map::new();
1618 obj.insert("throttleTimeMs".to_string(), ::serde_json::json!(0));
1619 obj.insert("groups".to_string(), ::serde_json::Value::Array(vec![]));
1620 ::serde_json::Value::Object(obj)
1621}