github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/createacls/createacls.go (about) 1 package createacls 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=v3,tag"` 13 14 Creations []RequestACLs `kafka:"min=v0,max=v3"` 15 } 16 17 func (r *Request) ApiKey() protocol.ApiKey { return protocol.CreateAcls } 18 19 func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) { 20 return cluster.Brokers[cluster.Controller], nil 21 } 22 23 type RequestACLs struct { 24 // We need at least one tagged field to indicate that v2+ uses "flexible" 25 // messages. 26 _ struct{} `kafka:"min=v2,max=v3,tag"` 27 28 ResourceType int8 `kafka:"min=v0,max=v3"` 29 ResourceName string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"` 30 ResourcePatternType int8 `kafka:"min=v1,max=v3"` 31 Principal string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"` 32 Host string `kafka:"min=v0,max=v1|min=v2,max=v3,compact"` 33 Operation int8 `kafka:"min=v0,max=v3"` 34 PermissionType int8 `kafka:"min=v0,max=v3"` 35 } 36 37 type Response struct { 38 // We need at least one tagged field to indicate that v2+ uses "flexible" 39 // messages. 40 _ struct{} `kafka:"min=v2,max=v3,tag"` 41 42 ThrottleTimeMs int32 `kafka:"min=v0,max=v3"` 43 Results []ResponseACLs `kafka:"min=v0,max=v3"` 44 } 45 46 func (r *Response) ApiKey() protocol.ApiKey { return protocol.CreateAcls } 47 48 type ResponseACLs struct { 49 // We need at least one tagged field to indicate that v2+ uses "flexible" 50 // messages. 51 _ struct{} `kafka:"min=v2,max=v3,tag"` 52 53 ErrorCode int16 `kafka:"min=v0,max=v3"` 54 ErrorMessage string `kafka:"min=v0,max=v1,nullable|min=v2,max=v3,nullable,compact"` 55 } 56 57 var _ protocol.BrokerMessage = (*Request)(nil)