describeacls.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package describeacls
  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 v2+ uses "flexible"
  8. // messages.
  9. _ struct{} `kafka:"min=v2,max=v3,tag"`
  10. Filter ACLFilter `kafka:"min=v0,max=v3"`
  11. }
  12. func (r *Request) ApiKey() protocol.ApiKey { return protocol.DescribeAcls }
  13. func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
  14. return cluster.Brokers[cluster.Controller], nil
  15. }
  16. type ACLFilter struct {
  17. // We need at least one tagged field to indicate that v2+ uses "flexible"
  18. // messages.
  19. _ struct{} `kafka:"min=v2,max=v3,tag"`
  20. ResourceTypeFilter int8 `kafka:"min=v0,max=v3"`
  21. ResourceNameFilter string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  22. ResourcePatternTypeFilter int8 `kafka:"min=v1,max=v3"`
  23. PrincipalFilter string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  24. HostFilter string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  25. Operation int8 `kafka:"min=v0,max=v3"`
  26. PermissionType int8 `kafka:"min=v0,max=v3"`
  27. }
  28. type Response struct {
  29. // We need at least one tagged field to indicate that v2+ uses "flexible"
  30. // messages.
  31. _ struct{} `kafka:"min=v2,max=v3,tag"`
  32. ThrottleTimeMs int32 `kafka:"min=v0,max=v3"`
  33. ErrorCode int16 `kafka:"min=v0,max=v3"`
  34. ErrorMessage string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  35. Resources []Resource `kafka:"min=v0,max=v3"`
  36. }
  37. func (r *Response) ApiKey() protocol.ApiKey { return protocol.DescribeAcls }
  38. type Resource struct {
  39. // We need at least one tagged field to indicate that v2+ uses "flexible"
  40. // messages.
  41. _ struct{} `kafka:"min=v2,max=v3,tag"`
  42. ResourceType int8 `kafka:"min=v0,max=v3"`
  43. ResourceName string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  44. PatternType int8 `kafka:"min=v1,max=v3"`
  45. ACLs []ResponseACL `kafka:"min=v0,max=v3"`
  46. }
  47. type ResponseACL struct {
  48. // We need at least one tagged field to indicate that v2+ uses "flexible"
  49. // messages.
  50. _ struct{} `kafka:"min=v2,max=v3,tag"`
  51. Principal string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  52. Host string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  53. Operation int8 `kafka:"min=v0,max=v3"`
  54. PermissionType int8 `kafka:"min=v0,max=v3"`
  55. }
  56. var _ protocol.BrokerMessage = (*Request)(nil)