forked from IBM/sarama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alter_user_scram_credentials_response.go
94 lines (75 loc) · 2.01 KB
/
alter_user_scram_credentials_response.go
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package sarama
import "time"
type AlterUserScramCredentialsResponse struct {
Version int16
ThrottleTime time.Duration
Results []*AlterUserScramCredentialsResult
}
type AlterUserScramCredentialsResult struct {
User string
ErrorCode KError
ErrorMessage *string
}
func (r *AlterUserScramCredentialsResponse) encode(pe packetEncoder) error {
pe.putInt32(int32(r.ThrottleTime / time.Millisecond))
pe.putCompactArrayLength(len(r.Results))
for _, u := range r.Results {
if err := pe.putCompactString(u.User); err != nil {
return err
}
pe.putInt16(int16(u.ErrorCode))
if err := pe.putNullableCompactString(u.ErrorMessage); err != nil {
return err
}
pe.putEmptyTaggedFieldArray()
}
pe.putEmptyTaggedFieldArray()
return nil
}
func (r *AlterUserScramCredentialsResponse) decode(pd packetDecoder, version int16) error {
throttleTime, err := pd.getInt32()
if err != nil {
return err
}
r.ThrottleTime = time.Duration(throttleTime) * time.Millisecond
numResults, err := pd.getCompactArrayLength()
if err != nil {
return err
}
if numResults > 0 {
r.Results = make([]*AlterUserScramCredentialsResult, numResults)
for i := 0; i < numResults; i++ {
r.Results[i] = &AlterUserScramCredentialsResult{}
if r.Results[i].User, err = pd.getCompactString(); err != nil {
return err
}
kerr, err := pd.getInt16()
if err != nil {
return err
}
r.Results[i].ErrorCode = KError(kerr)
if r.Results[i].ErrorMessage, err = pd.getCompactNullableString(); err != nil {
return err
}
if _, err := pd.getEmptyTaggedFieldArray(); err != nil {
return err
}
}
}
if _, err := pd.getEmptyTaggedFieldArray(); err != nil {
return err
}
return nil
}
func (r *AlterUserScramCredentialsResponse) key() int16 {
return 51
}
func (r *AlterUserScramCredentialsResponse) version() int16 {
return r.Version
}
func (r *AlterUserScramCredentialsResponse) headerVersion() int16 {
return 2
}
func (r *AlterUserScramCredentialsResponse) requiredVersion() KafkaVersion {
return V2_7_0_0
}