William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 1 | package sarama |
| 2 | |
| 3 | type SaslAuthenticateResponse struct { |
| 4 | Err KError |
| 5 | ErrorMessage *string |
| 6 | SaslAuthBytes []byte |
| 7 | } |
| 8 | |
| 9 | func (r *SaslAuthenticateResponse) encode(pe packetEncoder) error { |
| 10 | pe.putInt16(int16(r.Err)) |
| 11 | if err := pe.putNullableString(r.ErrorMessage); err != nil { |
| 12 | return err |
| 13 | } |
| 14 | return pe.putBytes(r.SaslAuthBytes) |
| 15 | } |
| 16 | |
| 17 | func (r *SaslAuthenticateResponse) decode(pd packetDecoder, version int16) error { |
| 18 | kerr, err := pd.getInt16() |
| 19 | if err != nil { |
| 20 | return err |
| 21 | } |
| 22 | |
| 23 | r.Err = KError(kerr) |
| 24 | |
| 25 | if r.ErrorMessage, err = pd.getNullableString(); err != nil { |
| 26 | return err |
| 27 | } |
| 28 | |
| 29 | r.SaslAuthBytes, err = pd.getBytes() |
| 30 | |
| 31 | return err |
| 32 | } |
| 33 | |
| 34 | func (r *SaslAuthenticateResponse) key() int16 { |
| 35 | return APIKeySASLAuth |
| 36 | } |
| 37 | |
| 38 | func (r *SaslAuthenticateResponse) version() int16 { |
| 39 | return 0 |
| 40 | } |
| 41 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame^] | 42 | func (r *SaslAuthenticateResponse) headerVersion() int16 { |
| 43 | return 0 |
| 44 | } |
| 45 | |
William Kurkian | ea86948 | 2019-04-09 15:16:11 -0400 | [diff] [blame] | 46 | func (r *SaslAuthenticateResponse) requiredVersion() KafkaVersion { |
| 47 | return V1_0_0_0 |
| 48 | } |