Skip to content

Commit

Permalink
add support for KIP-554
Browse files Browse the repository at this point in the history
  • Loading branch information
twmb committed Sep 7, 2020
1 parent 4ea4c42 commit ebadfda
Show file tree
Hide file tree
Showing 5 changed files with 852 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ a protocol is supported by code generation.
- [KIP-525](https://cwiki.apache.org/confluence/display/KAFKA/KIP-525+-+Return+topic+metadata+and+configs+in+CreateTopics+response) (create topics v5 returns configs; 2.4.0)
- [KIP-526](https://cwiki.apache.org/confluence/display/KAFKA/KIP-526%3A+Reduce+Producer+Metadata+Lookups+for+Large+Number+of+Topics) (reduce metadata lookups; done minus part 2, which we wont do)
- [KIP-546](https://cwiki.apache.org/confluence/display/KAFKA/KIP-546%3A+Add+Client+Quota+APIs+to+the+Admin+Client) (client quota APIs; 2.5.0)
- [KIP-554](https://cwiki.apache.org/confluence/display/KAFKA/KIP-554%3A+Add+Broker-side+SCRAM+Config+API) (broker side SCRAM API; 2.7.0)
- [KIP-559](https://cwiki.apache.org/confluence/display/KAFKA/KIP-559%3A+Make+the+Kafka+Protocol+Friendlier+with+L7+Proxies) (protocol info in sync / join; 2.5.0)
- [KIP-569](https://cwiki.apache.org/confluence/display/KAFKA/KIP-569%3A+DescribeConfigsResponse+-+Update+the+schema+to+include+additional+metadata+information+of+the+field) (doc/type in describe configs; 2.6.0)
- [KIP-570](https://cwiki.apache.org/confluence/display/KAFKA/KIP-570%3A+Add+leader+epoch+in+StopReplicaRequest) (leader epoch in stop replica; 2.6.0)
Expand Down
83 changes: 83 additions & 0 deletions generate/DEFINITIONS
Original file line number Diff line number Diff line change
Expand Up @@ -3529,3 +3529,86 @@ AlterClientQuotasResponse =>
Type: string
// Name is the name of the entity, or null for the default.
Name: nullable-string

// DescribeUserSCRAMCredentialsRequest, proposed in KIP-554 and introduced
// with Kafka 2.7.0, describes user SCRAM credentials.
//
// This request was introduced as part of the overarching KIP-500 initiative,
// which is to remove Zookeeper as a dependency.
//
// This request requires DESCRIBE on CLUSTER.
DescribeUserSCRAMCredentialsRequest => key 50, max version 0, flexible v0+
// The users to describe, or null to describe all.
Users: [=>]
// The user name.
Name: string

// DescribeUserSCRAMCredentialsResponse is a response for a
// DescribeUserSCRAMCredentialsRequest.
DescribeUserSCRAMCredentialsResponse =>
// ThrottleMillis is how long of a throttle Kafka will apply to the client
// after responding to this request.
ThrottleMillis: int32
// The request-level error code. This is 0 except for user or infra issues.
ErrorCode: int16
// The request-level error message, if any.
ErrorMessage: nullable-string
// Results for descriptions, one per user.
Results: [=>]
// The name this result corresponds to.
User: string
// The user-level error code.
ErrorCode: int16
// The user-level error message, if any.
ErrorMessage: nullable-string
// Information about the SCRAM credentials for this user.
CredentialInfos: [=>]
// The SCRAM mechanism for this user, where 0 is UNKNOWN, 1 is SCRAM_SHA_256,
// and 2 is SCRAM_SHA_512.
Mechanism: int8
// The number of iterations used in the SCRAM credential.
Iteractions: int32

// AlterUserSCRAMCredentialsRequest, proposed in KIP-554 and introduced
// with Kafka 2.7.0, alters or deletes user SCRAM credentials.
//
// This request was introduced as part of the overarching KIP-500 initiative,
// which is to remove Zookeeper as a dependency.
//
// This request requires ALTER on CLUSTER.
AlterUserSCRAMCredentialsRequest => key 51, max version 0, flexible v0+, admin
// The SCRAM credentials to remove.
Deletions: [=>]
// The user name to match for removal.
Name: string
// The mechanism for the user name to remove.
Mechanism: int8
// The SCRAM credentials to update or insert.
Upsertions: [=>]
// The user name to use.
Name: string
// The mechanism to use for creating. See
// DescribeUserSCRAMCredentialsResponse for more information.
Mechanism: int8
// The number of iterations to use. This must be more than the minimum for
// the mechanism and cannot be more than 16384.
Iterations: int32
// A random salt generated by the client.
Salt: bytes
// The salted password to use.
SaltedPassword: bytes

// AlterUserSCRAMCredentialsResponse is a response for an
// AlterUserSCRAMCredentialsRequest.
AlterUserSCRAMCredentialsResponse =>
// ThrottleMillis is how long of a throttle Kafka will apply to the client
// after responding to this request.
ThrottleMillis: int32
// The results for deletions and upsertions.
Results: [=>]
// The name this result corresponds to.
User: string
// The user-level error code.
ErrorCode: int16
// The user-level error message, if any.
ErrorMessage: nullable-string
6 changes: 6 additions & 0 deletions pkg/kerr/kerr.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ var (
UnstableOffsetCommit = &Error{"UNSTABLE_OFFSET_COMMIT", 88, true, "There are unstable offsets that need to be cleared."}
ThrottlingQuotaExceeded = &Error{"THROTTLING_QUOTA_EXCEEDED", 89, true, "The throttling quota has been exceeded."}
ProducerFenced = &Error{"PRODUCER_FENCED", 90, true, "There is a newer producer with the same transactionalId which fences the current one."}
ResourceNotFound = &Error{"RESOURCE_NOT_FOUND", 91, false, "A request illegally referred to a resource that does not exist."}
DuplicateResource = &Error{"DUPLICATE_RESOURCE", 92, false, "A request illegally referred to the same resource twice."}
UnacceptableCredential = &Error{"UNACCEPTABLE_CREDENTIAL", 91, false, "Requested credential would not meet criteria for acceptability."}
)

var code2err = map[int16]error{
Expand Down Expand Up @@ -229,4 +232,7 @@ var code2err = map[int16]error{
88: UnstableOffsetCommit,
89: ThrottlingQuotaExceeded,
90: ProducerFenced,
91: ResourceNotFound,
92: DuplicateResource,
93: UnacceptableCredential,
}
Loading

0 comments on commit ebadfda

Please sign in to comment.