github.com/segmentio/kafka-go@v0.4.48-0.20240318174348-3f6244eb34fd/protocol/alterpartitionreassignments/alterpartitionreassignments.go (about) 1 package alterpartitionreassignments 2 3 import "github.com/segmentio/kafka-go/protocol" 4 5 func init() { 6 protocol.Register(&Request{}, &Response{}) 7 } 8 9 // Detailed API definition: https://kafka.apache.org/protocol#The_Messages_AlterPartitionReassignments 10 type Request struct { 11 // We need at least one tagged field to indicate that this is a "flexible" message 12 // type. 13 _ struct{} `kafka:"min=v0,max=v0,tag"` 14 15 TimeoutMs int32 `kafka:"min=v0,max=v0"` 16 Topics []RequestTopic `kafka:"min=v0,max=v0"` 17 } 18 19 type RequestTopic struct { 20 Name string `kafka:"min=v0,max=v0"` 21 Partitions []RequestPartition `kafka:"min=v0,max=v0"` 22 } 23 24 type RequestPartition struct { 25 PartitionIndex int32 `kafka:"min=v0,max=v0"` 26 Replicas []int32 `kafka:"min=v0,max=v0,nullable"` 27 } 28 29 func (r *Request) ApiKey() protocol.ApiKey { 30 return protocol.AlterPartitionReassignments 31 } 32 33 func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) { 34 return cluster.Brokers[cluster.Controller], nil 35 } 36 37 type Response struct { 38 // We need at least one tagged field to indicate that this is a "flexible" message 39 // type. 40 _ struct{} `kafka:"min=v0,max=v0,tag"` 41 42 ThrottleTimeMs int32 `kafka:"min=v0,max=v0"` 43 ErrorCode int16 `kafka:"min=v0,max=v0"` 44 ErrorMessage string `kafka:"min=v0,max=v0,nullable"` 45 Results []ResponseResult `kafka:"min=v0,max=v0"` 46 } 47 48 type ResponseResult struct { 49 Name string `kafka:"min=v0,max=v0"` 50 Partitions []ResponsePartition `kafka:"min=v0,max=v0"` 51 } 52 53 type ResponsePartition struct { 54 PartitionIndex int32 `kafka:"min=v0,max=v0"` 55 ErrorCode int16 `kafka:"min=v0,max=v0"` 56 ErrorMessage string `kafka:"min=v0,max=v0,nullable"` 57 } 58 59 func (r *Response) ApiKey() protocol.ApiKey { 60 return protocol.AlterPartitionReassignments 61 }