1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
package sarama
type DescribeGroupsRequest struct {
Version int16
Groups []string
IncludeAuthorizedOperations bool
}
func (r *DescribeGroupsRequest) encode(pe packetEncoder) error {
if err := pe.putStringArray(r.Groups); err != nil {
return err
}
if r.Version >= 3 {
pe.putBool(r.IncludeAuthorizedOperations)
}
return nil
}
func (r *DescribeGroupsRequest) decode(pd packetDecoder, version int16) (err error) {
r.Version = version
r.Groups, err = pd.getStringArray()
if err != nil {
return err
}
if r.Version >= 3 {
if r.IncludeAuthorizedOperations, err = pd.getBool(); err != nil {
return err
}
}
return nil
}
func (r *DescribeGroupsRequest) key() int16 {
return 15
}
func (r *DescribeGroupsRequest) version() int16 {
return r.Version
}
func (r *DescribeGroupsRequest) headerVersion() int16 {
return 1
}
func (r *DescribeGroupsRequest) isValidVersion() bool {
return r.Version >= 0 && r.Version <= 4
}
func (r *DescribeGroupsRequest) requiredVersion() KafkaVersion {
switch r.Version {
case 4:
return V2_4_0_0
case 3:
return V2_3_0_0
case 2:
return V2_0_0_0
case 1:
return V0_11_0_0
case 0:
return V0_9_0_0
default:
return V2_4_0_0
}
}
func (r *DescribeGroupsRequest) AddGroup(group string) {
r.Groups = append(r.Groups, group)
}
|