sasl_authenticate_response.go 940 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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) headerVersion() int16 {
  33. return 0
  34. }
  35. func (r *SaslAuthenticateResponse) requiredVersion() KafkaVersion {
  36. return V1_0_0_0
  37. }