describeclientquotas.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package describeclientquotas
  2. import "github.com/segmentio/kafka-go/protocol"
  3. func init() {
  4. protocol.Register(&Request{}, &Response{})
  5. }
  6. type Request struct {
  7. // We need at least one tagged field to indicate that this is a "flexible" message
  8. // type.
  9. _ struct{} `kafka:"min=v1,max=v1,tag"`
  10. Components []Component `kafka:"min=v0,max=v1"`
  11. Strict bool `kafka:"min=v0,max=v1"`
  12. }
  13. func (r *Request) ApiKey() protocol.ApiKey { return protocol.DescribeClientQuotas }
  14. func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
  15. return cluster.Brokers[cluster.Controller], nil
  16. }
  17. type Component struct {
  18. // We need at least one tagged field to indicate that this is a "flexible" message
  19. // type.
  20. _ struct{} `kafka:"min=v1,max=v1,tag"`
  21. EntityType string `kafka:"min=v0,max=v1"`
  22. MatchType int8 `kafka:"min=v0,max=v1"`
  23. Match string `kafka:"min=v0,max=v1,nullable"`
  24. }
  25. type Response struct {
  26. // We need at least one tagged field to indicate that this is a "flexible" message
  27. // type.
  28. _ struct{} `kafka:"min=v1,max=v1,tag"`
  29. ThrottleTimeMs int32 `kafka:"min=v0,max=v1"`
  30. ErrorCode int16 `kafka:"min=v0,max=v1"`
  31. ErrorMessage string `kafka:"min=v0,max=v0,nullable|min=v1,max=v1,nullable,compact"`
  32. Entries []ResponseQuotas `kafka:"min=v0,max=v1"`
  33. }
  34. func (r *Response) ApiKey() protocol.ApiKey { return protocol.DescribeClientQuotas }
  35. type Entity struct {
  36. // We need at least one tagged field to indicate that this is a "flexible" message
  37. // type.
  38. _ struct{} `kafka:"min=v1,max=v1,tag"`
  39. EntityType string `kafka:"min=v0,max=v0|min=v1,max=v1,compact"`
  40. EntityName string `kafka:"min=v0,max=v0,nullable|min=v1,max=v1,nullable,compact"`
  41. }
  42. type Value struct {
  43. // We need at least one tagged field to indicate that this is a "flexible" message
  44. // type.
  45. _ struct{} `kafka:"min=v1,max=v1,tag"`
  46. Key string `kafka:"min=v0,max=v0|min=v1,max=v1,compact"`
  47. Value float64 `kafka:"min=v0,max=v1"`
  48. }
  49. type ResponseQuotas struct {
  50. // We need at least one tagged field to indicate that this is a "flexible" message
  51. // type.
  52. _ struct{} `kafka:"min=v1,max=v1,tag"`
  53. Entities []Entity `kafka:"min=v0,max=v1"`
  54. Values []Value `kafka:"min=v0,max=v1"`
  55. }
  56. var _ protocol.BrokerMessage = (*Request)(nil)