github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/describeclientquotas/describeclientquotas.go (about) 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 this is a "flexible" message 11 // type. 12 _ struct{} `kafka:"min=v1,max=v1,tag"` 13 Components []Component `kafka:"min=v0,max=v1"` 14 Strict bool `kafka:"min=v0,max=v1"` 15 } 16 17 func (r *Request) ApiKey() protocol.ApiKey { return protocol.DescribeClientQuotas } 18 19 func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) { 20 return cluster.Brokers[cluster.Controller], nil 21 } 22 23 type Component struct { 24 // We need at least one tagged field to indicate that this is a "flexible" message 25 // type. 26 _ struct{} `kafka:"min=v1,max=v1,tag"` 27 EntityType string `kafka:"min=v0,max=v1"` 28 MatchType int8 `kafka:"min=v0,max=v1"` 29 Match string `kafka:"min=v0,max=v1,nullable"` 30 } 31 32 type Response struct { 33 // We need at least one tagged field to indicate that this is a "flexible" message 34 // type. 35 _ struct{} `kafka:"min=v1,max=v1,tag"` 36 ThrottleTimeMs int32 `kafka:"min=v0,max=v1"` 37 ErrorCode int16 `kafka:"min=v0,max=v1"` 38 ErrorMessage string `kafka:"min=v0,max=v0,nullable|min=v1,max=v1,nullable,compact"` 39 Entries []ResponseQuotas `kafka:"min=v0,max=v1"` 40 } 41 42 func (r *Response) ApiKey() protocol.ApiKey { return protocol.DescribeClientQuotas } 43 44 type Entity struct { 45 // We need at least one tagged field to indicate that this is a "flexible" message 46 // type. 47 _ struct{} `kafka:"min=v1,max=v1,tag"` 48 EntityType string `kafka:"min=v0,max=v0|min=v1,max=v1,compact"` 49 EntityName string `kafka:"min=v0,max=v0,nullable|min=v1,max=v1,nullable,compact"` 50 } 51 52 type Value struct { 53 // We need at least one tagged field to indicate that this is a "flexible" message 54 // type. 55 _ struct{} `kafka:"min=v1,max=v1,tag"` 56 Key string `kafka:"min=v0,max=v0|min=v1,max=v1,compact"` 57 Value float64 `kafka:"min=v0,max=v1"` 58 } 59 60 type ResponseQuotas struct { 61 // We need at least one tagged field to indicate that this is a "flexible" message 62 // type. 63 _ struct{} `kafka:"min=v1,max=v1,tag"` 64 Entities []Entity `kafka:"min=v0,max=v1"` 65 Values []Value `kafka:"min=v0,max=v1"` 66 } 67 68 var _ protocol.BrokerMessage = (*Request)(nil)