deletegroups.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package deletegroups
  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=v2,max=v2,tag"`
  10. GroupIDs []string `kafka:"min=v0,max=v2"`
  11. }
  12. func (r *Request) Group() string {
  13. // use first group to determine group coordinator
  14. if len(r.GroupIDs) > 0 {
  15. return r.GroupIDs[0]
  16. }
  17. return ""
  18. }
  19. func (r *Request) ApiKey() protocol.ApiKey { return protocol.DeleteGroups }
  20. var (
  21. _ protocol.GroupMessage = (*Request)(nil)
  22. )
  23. type Response struct {
  24. // We need at least one tagged field to indicate that this is a "flexible" message
  25. // type.
  26. _ struct{} `kafka:"min=v2,max=v2,tag"`
  27. ThrottleTimeMs int32 `kafka:"min=v0,max=v2"`
  28. Responses []ResponseGroup `kafka:"min=v0,max=v2"`
  29. }
  30. func (r *Response) ApiKey() protocol.ApiKey { return protocol.DeleteGroups }
  31. type ResponseGroup struct {
  32. GroupID string `kafka:"min=v0,max=v2"`
  33. ErrorCode int16 `kafka:"min=v0,max=v2"`
  34. }