Takahiro Suzuki | d7bf820 | 2020-12-17 20:21:59 +0900 | [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 | |
| 42 | func (r *SaslAuthenticateResponse) requiredVersion() KafkaVersion { |
| 43 | return V1_0_0_0 |
| 44 | } |