deleteacls.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package deleteacls
  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. Filters []RequestFilter `kafka:"min=v0,max=v3"`
  11. }
  12. func (r *Request) ApiKey() protocol.ApiKey { return protocol.DeleteAcls }
  13. func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
  14. return cluster.Brokers[cluster.Controller], nil
  15. }
  16. type RequestFilter 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. FilterResults []FilterResult `kafka:"min=v0,max=v3"`
  34. }
  35. func (r *Response) ApiKey() protocol.ApiKey { return protocol.DeleteAcls }
  36. type FilterResult struct {
  37. // We need at least one tagged field to indicate that v2+ uses "flexible"
  38. // messages.
  39. _ struct{} `kafka:"min=v2,max=v3,tag"`
  40. ErrorCode int16 `kafka:"min=v0,max=v3"`
  41. ErrorMessage string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  42. MatchingACLs []MatchingACL `kafka:"min=v0,max=v3"`
  43. }
  44. type MatchingACL struct {
  45. // We need at least one tagged field to indicate that v2+ uses "flexible"
  46. // messages.
  47. _ struct{} `kafka:"min=v2,max=v3,tag"`
  48. ErrorCode int16 `kafka:"min=v0,max=v3"`
  49. ErrorMessage string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"`
  50. ResourceType int8 `kafka:"min=v0,max=v3"`
  51. ResourceName string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  52. ResourcePatternType int8 `kafka:"min=v1,max=v3"`
  53. Principal string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  54. Host string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"`
  55. Operation int8 `kafka:"min=v0,max=v3"`
  56. PermissionType int8 `kafka:"min=v0,max=v3"`
  57. }
  58. var _ protocol.BrokerMessage = (*Request)(nil)