kafka_protocol/messages/
describe_delegation_token_response.rs

1//! DescribeDelegationTokenResponse
2//!
3//! See the schema for this message [here](https://github.com/apache/kafka/blob/trunk/clients/src/main/resources/common/message/DescribeDelegationTokenResponse.json).
4// WARNING: the items of this module are generated and should not be edited directly
5#![allow(unused)]
6
7use std::borrow::Borrow;
8use std::collections::BTreeMap;
9
10use anyhow::{bail, Result};
11use bytes::Bytes;
12use uuid::Uuid;
13
14use crate::protocol::{
15    buf::{ByteBuf, ByteBufMut},
16    compute_unknown_tagged_fields_size, types, write_unknown_tagged_fields, Decodable, Decoder,
17    Encodable, Encoder, HeaderVersion, Message, StrBytes, VersionRange,
18};
19
20/// Valid versions: 1-3
21#[non_exhaustive]
22#[derive(Debug, Clone, PartialEq)]
23pub struct DescribeDelegationTokenResponse {
24    /// The error code, or 0 if there was no error.
25    ///
26    /// Supported API versions: 1-3
27    pub error_code: i16,
28
29    /// The tokens.
30    ///
31    /// Supported API versions: 1-3
32    pub tokens: Vec<DescribedDelegationToken>,
33
34    /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.
35    ///
36    /// Supported API versions: 1-3
37    pub throttle_time_ms: i32,
38
39    /// Other tagged fields
40    pub unknown_tagged_fields: BTreeMap<i32, Bytes>,
41}
42
43impl DescribeDelegationTokenResponse {
44    /// Sets `error_code` to the passed value.
45    ///
46    /// The error code, or 0 if there was no error.
47    ///
48    /// Supported API versions: 1-3
49    pub fn with_error_code(mut self, value: i16) -> Self {
50        self.error_code = value;
51        self
52    }
53    /// Sets `tokens` to the passed value.
54    ///
55    /// The tokens.
56    ///
57    /// Supported API versions: 1-3
58    pub fn with_tokens(mut self, value: Vec<DescribedDelegationToken>) -> Self {
59        self.tokens = value;
60        self
61    }
62    /// Sets `throttle_time_ms` to the passed value.
63    ///
64    /// The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota.
65    ///
66    /// Supported API versions: 1-3
67    pub fn with_throttle_time_ms(mut self, value: i32) -> Self {
68        self.throttle_time_ms = value;
69        self
70    }
71    /// Sets unknown_tagged_fields to the passed value.
72    pub fn with_unknown_tagged_fields(mut self, value: BTreeMap<i32, Bytes>) -> Self {
73        self.unknown_tagged_fields = value;
74        self
75    }
76    /// Inserts an entry into unknown_tagged_fields.
77    pub fn with_unknown_tagged_field(mut self, key: i32, value: Bytes) -> Self {
78        self.unknown_tagged_fields.insert(key, value);
79        self
80    }
81}
82
83#[cfg(feature = "broker")]
84impl Encodable for DescribeDelegationTokenResponse {
85    fn encode<B: ByteBufMut>(&self, buf: &mut B, version: i16) -> Result<()> {
86        if version < 1 || version > 3 {
87            bail!("specified version not supported by this message type");
88        }
89        types::Int16.encode(buf, &self.error_code)?;
90        if version >= 2 {
91            types::CompactArray(types::Struct { version }).encode(buf, &self.tokens)?;
92        } else {
93            types::Array(types::Struct { version }).encode(buf, &self.tokens)?;
94        }
95        types::Int32.encode(buf, &self.throttle_time_ms)?;
96        if version >= 2 {
97            let num_tagged_fields = self.unknown_tagged_fields.len();
98            if num_tagged_fields > std::u32::MAX as usize {
99                bail!(
100                    "Too many tagged fields to encode ({} fields)",
101                    num_tagged_fields
102                );
103            }
104            types::UnsignedVarInt.encode(buf, num_tagged_fields as u32)?;
105
106            write_unknown_tagged_fields(buf, 0.., &self.unknown_tagged_fields)?;
107        }
108        Ok(())
109    }
110    fn compute_size(&self, version: i16) -> Result<usize> {
111        let mut total_size = 0;
112        total_size += types::Int16.compute_size(&self.error_code)?;
113        if version >= 2 {
114            total_size +=
115                types::CompactArray(types::Struct { version }).compute_size(&self.tokens)?;
116        } else {
117            total_size += types::Array(types::Struct { version }).compute_size(&self.tokens)?;
118        }
119        total_size += types::Int32.compute_size(&self.throttle_time_ms)?;
120        if version >= 2 {
121            let num_tagged_fields = self.unknown_tagged_fields.len();
122            if num_tagged_fields > std::u32::MAX as usize {
123                bail!(
124                    "Too many tagged fields to encode ({} fields)",
125                    num_tagged_fields
126                );
127            }
128            total_size += types::UnsignedVarInt.compute_size(num_tagged_fields as u32)?;
129
130            total_size += compute_unknown_tagged_fields_size(&self.unknown_tagged_fields)?;
131        }
132        Ok(total_size)
133    }
134}
135
136#[cfg(feature = "client")]
137impl Decodable for DescribeDelegationTokenResponse {
138    fn decode<B: ByteBuf>(buf: &mut B, version: i16) -> Result<Self> {
139        if version < 1 || version > 3 {
140            bail!("specified version not supported by this message type");
141        }
142        let error_code = types::Int16.decode(buf)?;
143        let tokens = if version >= 2 {
144            types::CompactArray(types::Struct { version }).decode(buf)?
145        } else {
146            types::Array(types::Struct { version }).decode(buf)?
147        };
148        let throttle_time_ms = types::Int32.decode(buf)?;
149        let mut unknown_tagged_fields = BTreeMap::new();
150        if version >= 2 {
151            let num_tagged_fields = types::UnsignedVarInt.decode(buf)?;
152            for _ in 0..num_tagged_fields {
153                let tag: u32 = types::UnsignedVarInt.decode(buf)?;
154                let size: u32 = types::UnsignedVarInt.decode(buf)?;
155                let unknown_value = buf.try_get_bytes(size as usize)?;
156                unknown_tagged_fields.insert(tag as i32, unknown_value);
157            }
158        }
159        Ok(Self {
160            error_code,
161            tokens,
162            throttle_time_ms,
163            unknown_tagged_fields,
164        })
165    }
166}
167
168impl Default for DescribeDelegationTokenResponse {
169    fn default() -> Self {
170        Self {
171            error_code: 0,
172            tokens: Default::default(),
173            throttle_time_ms: 0,
174            unknown_tagged_fields: BTreeMap::new(),
175        }
176    }
177}
178
179impl Message for DescribeDelegationTokenResponse {
180    const VERSIONS: VersionRange = VersionRange { min: 1, max: 3 };
181    const DEPRECATED_VERSIONS: Option<VersionRange> = None;
182}
183
184/// Valid versions: 1-3
185#[non_exhaustive]
186#[derive(Debug, Clone, PartialEq)]
187pub struct DescribedDelegationToken {
188    /// The token principal type.
189    ///
190    /// Supported API versions: 1-3
191    pub principal_type: StrBytes,
192
193    /// The token principal name.
194    ///
195    /// Supported API versions: 1-3
196    pub principal_name: StrBytes,
197
198    /// The principal type of the requester of the token.
199    ///
200    /// Supported API versions: 3
201    pub token_requester_principal_type: StrBytes,
202
203    /// The principal type of the requester of the token.
204    ///
205    /// Supported API versions: 3
206    pub token_requester_principal_name: StrBytes,
207
208    /// The token issue timestamp in milliseconds.
209    ///
210    /// Supported API versions: 1-3
211    pub issue_timestamp: i64,
212
213    /// The token expiry timestamp in milliseconds.
214    ///
215    /// Supported API versions: 1-3
216    pub expiry_timestamp: i64,
217
218    /// The token maximum timestamp length in milliseconds.
219    ///
220    /// Supported API versions: 1-3
221    pub max_timestamp: i64,
222
223    /// The token ID.
224    ///
225    /// Supported API versions: 1-3
226    pub token_id: StrBytes,
227
228    /// The token HMAC.
229    ///
230    /// Supported API versions: 1-3
231    pub hmac: Bytes,
232
233    /// Those who are able to renew this token before it expires.
234    ///
235    /// Supported API versions: 1-3
236    pub renewers: Vec<DescribedDelegationTokenRenewer>,
237
238    /// Other tagged fields
239    pub unknown_tagged_fields: BTreeMap<i32, Bytes>,
240}
241
242impl DescribedDelegationToken {
243    /// Sets `principal_type` to the passed value.
244    ///
245    /// The token principal type.
246    ///
247    /// Supported API versions: 1-3
248    pub fn with_principal_type(mut self, value: StrBytes) -> Self {
249        self.principal_type = value;
250        self
251    }
252    /// Sets `principal_name` to the passed value.
253    ///
254    /// The token principal name.
255    ///
256    /// Supported API versions: 1-3
257    pub fn with_principal_name(mut self, value: StrBytes) -> Self {
258        self.principal_name = value;
259        self
260    }
261    /// Sets `token_requester_principal_type` to the passed value.
262    ///
263    /// The principal type of the requester of the token.
264    ///
265    /// Supported API versions: 3
266    pub fn with_token_requester_principal_type(mut self, value: StrBytes) -> Self {
267        self.token_requester_principal_type = value;
268        self
269    }
270    /// Sets `token_requester_principal_name` to the passed value.
271    ///
272    /// The principal type of the requester of the token.
273    ///
274    /// Supported API versions: 3
275    pub fn with_token_requester_principal_name(mut self, value: StrBytes) -> Self {
276        self.token_requester_principal_name = value;
277        self
278    }
279    /// Sets `issue_timestamp` to the passed value.
280    ///
281    /// The token issue timestamp in milliseconds.
282    ///
283    /// Supported API versions: 1-3
284    pub fn with_issue_timestamp(mut self, value: i64) -> Self {
285        self.issue_timestamp = value;
286        self
287    }
288    /// Sets `expiry_timestamp` to the passed value.
289    ///
290    /// The token expiry timestamp in milliseconds.
291    ///
292    /// Supported API versions: 1-3
293    pub fn with_expiry_timestamp(mut self, value: i64) -> Self {
294        self.expiry_timestamp = value;
295        self
296    }
297    /// Sets `max_timestamp` to the passed value.
298    ///
299    /// The token maximum timestamp length in milliseconds.
300    ///
301    /// Supported API versions: 1-3
302    pub fn with_max_timestamp(mut self, value: i64) -> Self {
303        self.max_timestamp = value;
304        self
305    }
306    /// Sets `token_id` to the passed value.
307    ///
308    /// The token ID.
309    ///
310    /// Supported API versions: 1-3
311    pub fn with_token_id(mut self, value: StrBytes) -> Self {
312        self.token_id = value;
313        self
314    }
315    /// Sets `hmac` to the passed value.
316    ///
317    /// The token HMAC.
318    ///
319    /// Supported API versions: 1-3
320    pub fn with_hmac(mut self, value: Bytes) -> Self {
321        self.hmac = value;
322        self
323    }
324    /// Sets `renewers` to the passed value.
325    ///
326    /// Those who are able to renew this token before it expires.
327    ///
328    /// Supported API versions: 1-3
329    pub fn with_renewers(mut self, value: Vec<DescribedDelegationTokenRenewer>) -> Self {
330        self.renewers = value;
331        self
332    }
333    /// Sets unknown_tagged_fields to the passed value.
334    pub fn with_unknown_tagged_fields(mut self, value: BTreeMap<i32, Bytes>) -> Self {
335        self.unknown_tagged_fields = value;
336        self
337    }
338    /// Inserts an entry into unknown_tagged_fields.
339    pub fn with_unknown_tagged_field(mut self, key: i32, value: Bytes) -> Self {
340        self.unknown_tagged_fields.insert(key, value);
341        self
342    }
343}
344
345#[cfg(feature = "broker")]
346impl Encodable for DescribedDelegationToken {
347    fn encode<B: ByteBufMut>(&self, buf: &mut B, version: i16) -> Result<()> {
348        if version < 1 || version > 3 {
349            bail!("specified version not supported by this message type");
350        }
351        if version >= 2 {
352            types::CompactString.encode(buf, &self.principal_type)?;
353        } else {
354            types::String.encode(buf, &self.principal_type)?;
355        }
356        if version >= 2 {
357            types::CompactString.encode(buf, &self.principal_name)?;
358        } else {
359            types::String.encode(buf, &self.principal_name)?;
360        }
361        if version >= 3 {
362            types::CompactString.encode(buf, &self.token_requester_principal_type)?;
363        } else {
364            if !self.token_requester_principal_type.is_empty() {
365                bail!("A field is set that is not available on the selected protocol version");
366            }
367        }
368        if version >= 3 {
369            types::CompactString.encode(buf, &self.token_requester_principal_name)?;
370        } else {
371            if !self.token_requester_principal_name.is_empty() {
372                bail!("A field is set that is not available on the selected protocol version");
373            }
374        }
375        types::Int64.encode(buf, &self.issue_timestamp)?;
376        types::Int64.encode(buf, &self.expiry_timestamp)?;
377        types::Int64.encode(buf, &self.max_timestamp)?;
378        if version >= 2 {
379            types::CompactString.encode(buf, &self.token_id)?;
380        } else {
381            types::String.encode(buf, &self.token_id)?;
382        }
383        if version >= 2 {
384            types::CompactBytes.encode(buf, &self.hmac)?;
385        } else {
386            types::Bytes.encode(buf, &self.hmac)?;
387        }
388        if version >= 2 {
389            types::CompactArray(types::Struct { version }).encode(buf, &self.renewers)?;
390        } else {
391            types::Array(types::Struct { version }).encode(buf, &self.renewers)?;
392        }
393        if version >= 2 {
394            let num_tagged_fields = self.unknown_tagged_fields.len();
395            if num_tagged_fields > std::u32::MAX as usize {
396                bail!(
397                    "Too many tagged fields to encode ({} fields)",
398                    num_tagged_fields
399                );
400            }
401            types::UnsignedVarInt.encode(buf, num_tagged_fields as u32)?;
402
403            write_unknown_tagged_fields(buf, 0.., &self.unknown_tagged_fields)?;
404        }
405        Ok(())
406    }
407    fn compute_size(&self, version: i16) -> Result<usize> {
408        let mut total_size = 0;
409        if version >= 2 {
410            total_size += types::CompactString.compute_size(&self.principal_type)?;
411        } else {
412            total_size += types::String.compute_size(&self.principal_type)?;
413        }
414        if version >= 2 {
415            total_size += types::CompactString.compute_size(&self.principal_name)?;
416        } else {
417            total_size += types::String.compute_size(&self.principal_name)?;
418        }
419        if version >= 3 {
420            total_size +=
421                types::CompactString.compute_size(&self.token_requester_principal_type)?;
422        } else {
423            if !self.token_requester_principal_type.is_empty() {
424                bail!("A field is set that is not available on the selected protocol version");
425            }
426        }
427        if version >= 3 {
428            total_size +=
429                types::CompactString.compute_size(&self.token_requester_principal_name)?;
430        } else {
431            if !self.token_requester_principal_name.is_empty() {
432                bail!("A field is set that is not available on the selected protocol version");
433            }
434        }
435        total_size += types::Int64.compute_size(&self.issue_timestamp)?;
436        total_size += types::Int64.compute_size(&self.expiry_timestamp)?;
437        total_size += types::Int64.compute_size(&self.max_timestamp)?;
438        if version >= 2 {
439            total_size += types::CompactString.compute_size(&self.token_id)?;
440        } else {
441            total_size += types::String.compute_size(&self.token_id)?;
442        }
443        if version >= 2 {
444            total_size += types::CompactBytes.compute_size(&self.hmac)?;
445        } else {
446            total_size += types::Bytes.compute_size(&self.hmac)?;
447        }
448        if version >= 2 {
449            total_size +=
450                types::CompactArray(types::Struct { version }).compute_size(&self.renewers)?;
451        } else {
452            total_size += types::Array(types::Struct { version }).compute_size(&self.renewers)?;
453        }
454        if version >= 2 {
455            let num_tagged_fields = self.unknown_tagged_fields.len();
456            if num_tagged_fields > std::u32::MAX as usize {
457                bail!(
458                    "Too many tagged fields to encode ({} fields)",
459                    num_tagged_fields
460                );
461            }
462            total_size += types::UnsignedVarInt.compute_size(num_tagged_fields as u32)?;
463
464            total_size += compute_unknown_tagged_fields_size(&self.unknown_tagged_fields)?;
465        }
466        Ok(total_size)
467    }
468}
469
470#[cfg(feature = "client")]
471impl Decodable for DescribedDelegationToken {
472    fn decode<B: ByteBuf>(buf: &mut B, version: i16) -> Result<Self> {
473        if version < 1 || version > 3 {
474            bail!("specified version not supported by this message type");
475        }
476        let principal_type = if version >= 2 {
477            types::CompactString.decode(buf)?
478        } else {
479            types::String.decode(buf)?
480        };
481        let principal_name = if version >= 2 {
482            types::CompactString.decode(buf)?
483        } else {
484            types::String.decode(buf)?
485        };
486        let token_requester_principal_type = if version >= 3 {
487            types::CompactString.decode(buf)?
488        } else {
489            Default::default()
490        };
491        let token_requester_principal_name = if version >= 3 {
492            types::CompactString.decode(buf)?
493        } else {
494            Default::default()
495        };
496        let issue_timestamp = types::Int64.decode(buf)?;
497        let expiry_timestamp = types::Int64.decode(buf)?;
498        let max_timestamp = types::Int64.decode(buf)?;
499        let token_id = if version >= 2 {
500            types::CompactString.decode(buf)?
501        } else {
502            types::String.decode(buf)?
503        };
504        let hmac = if version >= 2 {
505            types::CompactBytes.decode(buf)?
506        } else {
507            types::Bytes.decode(buf)?
508        };
509        let renewers = if version >= 2 {
510            types::CompactArray(types::Struct { version }).decode(buf)?
511        } else {
512            types::Array(types::Struct { version }).decode(buf)?
513        };
514        let mut unknown_tagged_fields = BTreeMap::new();
515        if version >= 2 {
516            let num_tagged_fields = types::UnsignedVarInt.decode(buf)?;
517            for _ in 0..num_tagged_fields {
518                let tag: u32 = types::UnsignedVarInt.decode(buf)?;
519                let size: u32 = types::UnsignedVarInt.decode(buf)?;
520                let unknown_value = buf.try_get_bytes(size as usize)?;
521                unknown_tagged_fields.insert(tag as i32, unknown_value);
522            }
523        }
524        Ok(Self {
525            principal_type,
526            principal_name,
527            token_requester_principal_type,
528            token_requester_principal_name,
529            issue_timestamp,
530            expiry_timestamp,
531            max_timestamp,
532            token_id,
533            hmac,
534            renewers,
535            unknown_tagged_fields,
536        })
537    }
538}
539
540impl Default for DescribedDelegationToken {
541    fn default() -> Self {
542        Self {
543            principal_type: Default::default(),
544            principal_name: Default::default(),
545            token_requester_principal_type: Default::default(),
546            token_requester_principal_name: Default::default(),
547            issue_timestamp: 0,
548            expiry_timestamp: 0,
549            max_timestamp: 0,
550            token_id: Default::default(),
551            hmac: Default::default(),
552            renewers: Default::default(),
553            unknown_tagged_fields: BTreeMap::new(),
554        }
555    }
556}
557
558impl Message for DescribedDelegationToken {
559    const VERSIONS: VersionRange = VersionRange { min: 1, max: 3 };
560    const DEPRECATED_VERSIONS: Option<VersionRange> = None;
561}
562
563/// Valid versions: 1-3
564#[non_exhaustive]
565#[derive(Debug, Clone, PartialEq)]
566pub struct DescribedDelegationTokenRenewer {
567    /// The renewer principal type.
568    ///
569    /// Supported API versions: 1-3
570    pub principal_type: StrBytes,
571
572    /// The renewer principal name.
573    ///
574    /// Supported API versions: 1-3
575    pub principal_name: StrBytes,
576
577    /// Other tagged fields
578    pub unknown_tagged_fields: BTreeMap<i32, Bytes>,
579}
580
581impl DescribedDelegationTokenRenewer {
582    /// Sets `principal_type` to the passed value.
583    ///
584    /// The renewer principal type.
585    ///
586    /// Supported API versions: 1-3
587    pub fn with_principal_type(mut self, value: StrBytes) -> Self {
588        self.principal_type = value;
589        self
590    }
591    /// Sets `principal_name` to the passed value.
592    ///
593    /// The renewer principal name.
594    ///
595    /// Supported API versions: 1-3
596    pub fn with_principal_name(mut self, value: StrBytes) -> Self {
597        self.principal_name = value;
598        self
599    }
600    /// Sets unknown_tagged_fields to the passed value.
601    pub fn with_unknown_tagged_fields(mut self, value: BTreeMap<i32, Bytes>) -> Self {
602        self.unknown_tagged_fields = value;
603        self
604    }
605    /// Inserts an entry into unknown_tagged_fields.
606    pub fn with_unknown_tagged_field(mut self, key: i32, value: Bytes) -> Self {
607        self.unknown_tagged_fields.insert(key, value);
608        self
609    }
610}
611
612#[cfg(feature = "broker")]
613impl Encodable for DescribedDelegationTokenRenewer {
614    fn encode<B: ByteBufMut>(&self, buf: &mut B, version: i16) -> Result<()> {
615        if version < 1 || version > 3 {
616            bail!("specified version not supported by this message type");
617        }
618        if version >= 2 {
619            types::CompactString.encode(buf, &self.principal_type)?;
620        } else {
621            types::String.encode(buf, &self.principal_type)?;
622        }
623        if version >= 2 {
624            types::CompactString.encode(buf, &self.principal_name)?;
625        } else {
626            types::String.encode(buf, &self.principal_name)?;
627        }
628        if version >= 2 {
629            let num_tagged_fields = self.unknown_tagged_fields.len();
630            if num_tagged_fields > std::u32::MAX as usize {
631                bail!(
632                    "Too many tagged fields to encode ({} fields)",
633                    num_tagged_fields
634                );
635            }
636            types::UnsignedVarInt.encode(buf, num_tagged_fields as u32)?;
637
638            write_unknown_tagged_fields(buf, 0.., &self.unknown_tagged_fields)?;
639        }
640        Ok(())
641    }
642    fn compute_size(&self, version: i16) -> Result<usize> {
643        let mut total_size = 0;
644        if version >= 2 {
645            total_size += types::CompactString.compute_size(&self.principal_type)?;
646        } else {
647            total_size += types::String.compute_size(&self.principal_type)?;
648        }
649        if version >= 2 {
650            total_size += types::CompactString.compute_size(&self.principal_name)?;
651        } else {
652            total_size += types::String.compute_size(&self.principal_name)?;
653        }
654        if version >= 2 {
655            let num_tagged_fields = self.unknown_tagged_fields.len();
656            if num_tagged_fields > std::u32::MAX as usize {
657                bail!(
658                    "Too many tagged fields to encode ({} fields)",
659                    num_tagged_fields
660                );
661            }
662            total_size += types::UnsignedVarInt.compute_size(num_tagged_fields as u32)?;
663
664            total_size += compute_unknown_tagged_fields_size(&self.unknown_tagged_fields)?;
665        }
666        Ok(total_size)
667    }
668}
669
670#[cfg(feature = "client")]
671impl Decodable for DescribedDelegationTokenRenewer {
672    fn decode<B: ByteBuf>(buf: &mut B, version: i16) -> Result<Self> {
673        if version < 1 || version > 3 {
674            bail!("specified version not supported by this message type");
675        }
676        let principal_type = if version >= 2 {
677            types::CompactString.decode(buf)?
678        } else {
679            types::String.decode(buf)?
680        };
681        let principal_name = if version >= 2 {
682            types::CompactString.decode(buf)?
683        } else {
684            types::String.decode(buf)?
685        };
686        let mut unknown_tagged_fields = BTreeMap::new();
687        if version >= 2 {
688            let num_tagged_fields = types::UnsignedVarInt.decode(buf)?;
689            for _ in 0..num_tagged_fields {
690                let tag: u32 = types::UnsignedVarInt.decode(buf)?;
691                let size: u32 = types::UnsignedVarInt.decode(buf)?;
692                let unknown_value = buf.try_get_bytes(size as usize)?;
693                unknown_tagged_fields.insert(tag as i32, unknown_value);
694            }
695        }
696        Ok(Self {
697            principal_type,
698            principal_name,
699            unknown_tagged_fields,
700        })
701    }
702}
703
704impl Default for DescribedDelegationTokenRenewer {
705    fn default() -> Self {
706        Self {
707            principal_type: Default::default(),
708            principal_name: Default::default(),
709            unknown_tagged_fields: BTreeMap::new(),
710        }
711    }
712}
713
714impl Message for DescribedDelegationTokenRenewer {
715    const VERSIONS: VersionRange = VersionRange { min: 1, max: 3 };
716    const DEPRECATED_VERSIONS: Option<VersionRange> = None;
717}
718
719impl HeaderVersion for DescribeDelegationTokenResponse {
720    fn header_version(version: i16) -> i16 {
721        if version >= 2 {
722            1
723        } else {
724            0
725        }
726    }
727}