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