sasl_authenticate_response.go 868 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package sarama
  2. type SaslAuthenticateResponse struct {
  3. Err KError
  4. ErrorMessage *string
  5. SaslAuthBytes []byte
  6. }
  7. func (r *SaslAuthenticateResponse) encode(pe packetEncoder) error {
  8. pe.putInt16(int16(r.Err))
  9. if err := pe.putNullableString(r.ErrorMessage); err != nil {
  10. return err
  11. }
  12. return pe.putBytes(r.SaslAuthBytes)
  13. }
  14. func (r *SaslAuthenticateResponse) decode(pd packetDecoder, version int16) error {
  15. kerr, err := pd.getInt16()
  16. if err != nil {
  17. return err
  18. }
  19. r.Err = KError(kerr)
  20. if r.ErrorMessage, err = pd.getNullableString(); err != nil {
  21. return err
  22. }
  23. r.SaslAuthBytes, err = pd.getBytes()
  24. return err
  25. }
  26. func (r *SaslAuthenticateResponse) key() int16 {
  27. return APIKeySASLAuth
  28. }
  29. func (r *SaslAuthenticateResponse) version() int16 {
  30. return 0
  31. }
  32. func (r *SaslAuthenticateResponse) requiredVersion() KafkaVersion {
  33. return V1_0_0_0
  34. }