|
| 1 | +package alterclientquotas |
| 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 | + Entries []Entry `kafka:"min=v0,max=v1"` |
| 15 | + ValidateOnly boolean `kafka:"min=v0,max=v1"` |
| 16 | +} |
| 17 | + |
| 18 | +func (r *Request) ApiKey() protocol.ApiKey { return protocol.AlterClientQuotas } |
| 19 | + |
| 20 | +func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) { |
| 21 | + return cluster.Brokers[cluster.Controller], nil |
| 22 | +} |
| 23 | + |
| 24 | +type Entry struct { |
| 25 | + Entities []Entity `kafka:"min=v0,max=v1"` |
| 26 | + Ops []Ops `kafka:"min=v0,max=v1"` |
| 27 | +} |
| 28 | + |
| 29 | +type Entity struct { |
| 30 | + EntityType string `kafka:"min=v0,max=v1"` |
| 31 | + EntityName string `kafka:"min=v0,max=v1",nullable` |
| 32 | +} |
| 33 | + |
| 34 | +type Ops struct { |
| 35 | + Key string `kafka:"min=v0,max=v1"` |
| 36 | + Value float64 `kafka:"min=v0,max=v1"` |
| 37 | + Remove boolean `kafka:"min=v0,max=v1"` |
| 38 | +} |
| 39 | + |
| 40 | +type Response struct { |
| 41 | + // We need at least one tagged field to indicate that v2+ uses "flexible" |
| 42 | + // messages. |
| 43 | + _ struct{} `kafka:"min=v2,max=v2,tag"` |
| 44 | + |
| 45 | + ThrottleTimeMs int32 `kafka:"min=v0,max=v1"` |
| 46 | + Results []ResponseQuotas `kafka:"min=v0,max=v1"` |
| 47 | +} |
| 48 | + |
| 49 | +func (r *Response) ApiKey() protocol.ApiKey { return protocol.CreateAcls } |
| 50 | + |
| 51 | +type ResponseQuotas struct { |
| 52 | + ErrorCode int16 `kafka:"min=v0,max=v1"` |
| 53 | + ErrorMessage string `kafka:"min=v0,max=v1,nullable"` |
| 54 | + Entities []Entity `kafka:"min=v0,max=v1"` |
| 55 | +} |
| 56 | + |
| 57 | +var _ protocol.BrokerMessage = (*Request)(nil) |
0 commit comments