github.com/hoveychen/kafka-go@v0.4.42/protocol/alterconfigs/alterconfigs.go (about)

     1  package alterconfigs
     2  
     3  import "github.com/hoveychen/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_AlterConfigs
    10  type Request struct {
    11  	Resources    []RequestResources `kafka:"min=v0,max=v1"`
    12  	ValidateOnly bool               `kafka:"min=v0,max=v1"`
    13  }
    14  
    15  func (r *Request) ApiKey() protocol.ApiKey { return protocol.AlterConfigs }
    16  
    17  func (r *Request) Broker(cluster protocol.Cluster) (protocol.Broker, error) {
    18  	return cluster.Brokers[cluster.Controller], nil
    19  }
    20  
    21  type RequestResources struct {
    22  	ResourceType int8            `kafka:"min=v0,max=v1"`
    23  	ResourceName string          `kafka:"min=v0,max=v1"`
    24  	Configs      []RequestConfig `kafka:"min=v0,max=v1"`
    25  }
    26  
    27  type RequestConfig struct {
    28  	Name  string `kafka:"min=v0,max=v1"`
    29  	Value string `kafka:"min=v0,max=v1,nullable"`
    30  }
    31  
    32  type Response struct {
    33  	ThrottleTimeMs int32               `kafka:"min=v0,max=v1"`
    34  	Responses      []ResponseResponses `kafka:"min=v0,max=v1"`
    35  }
    36  
    37  func (r *Response) ApiKey() protocol.ApiKey { return protocol.AlterConfigs }
    38  
    39  type ResponseResponses struct {
    40  	ErrorCode    int16  `kafka:"min=v0,max=v1"`
    41  	ErrorMessage string `kafka:"min=v0,max=v1,nullable"`
    42  	ResourceType int8   `kafka:"min=v0,max=v1"`
    43  	ResourceName string `kafka:"min=v0,max=v1"`
    44  }
    45  
    46  var (
    47  	_ protocol.BrokerMessage = (*Request)(nil)
    48  )