github.com/hoveychen/kafka-go@v0.4.42/protocol/createacls/createacls.go (about) 1 package createacls 2 3 import "github.com/hoveychen/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 Creations []RequestACLs `kafka:"min=v0,max=v2"` 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 ResourceType int8 `kafka:"min=v0,max=v2"` 25 ResourceName string `kafka:"min=v0,max=v2"` 26 ResourcePatternType int8 `kafka:"min=v0,max=v2"` 27 Principal string `kafka:"min=v0,max=v2"` 28 Host string `kafka:"min=v0,max=v2"` 29 Operation int8 `kafka:"min=v0,max=v2"` 30 PermissionType int8 `kafka:"min=v0,max=v2"` 31 } 32 33 type Response struct { 34 // We need at least one tagged field to indicate that v2+ uses "flexible" 35 // messages. 36 _ struct{} `kafka:"min=v2,max=v2,tag"` 37 38 ThrottleTimeMs int32 `kafka:"min=v0,max=v2"` 39 Results []ResponseACLs `kafka:"min=v0,max=v2"` 40 } 41 42 func (r *Response) ApiKey() protocol.ApiKey { return protocol.CreateAcls } 43 44 type ResponseACLs struct { 45 ErrorCode int16 `kafka:"min=v0,max=v2"` 46 ErrorMessage string `kafka:"min=v0,max=v2,nullable"` 47 } 48 49 var _ protocol.BrokerMessage = (*Request)(nil)