From f31eea787a3f6fe8ccb1822b033d1e93c1623557 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Wed, 20 Sep 2023 19:33:09 -0600 Subject: [PATCH 1/2] kmsg: document more errors for describe user scram credentials --- generate/definitions/50_describe_user_scram_credentials | 8 +++++++- pkg/kmsg/generated.go | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/generate/definitions/50_describe_user_scram_credentials b/generate/definitions/50_describe_user_scram_credentials index a80036e0..7b07652f 100644 --- a/generate/definitions/50_describe_user_scram_credentials +++ b/generate/definitions/50_describe_user_scram_credentials @@ -15,7 +15,9 @@ DescribeUserSCRAMCredentialsRequest => key 50, max version 0, flexible v0+ // DescribeUserSCRAMCredentialsRequest. DescribeUserSCRAMCredentialsResponse => ThrottleMillis - // The request-level error code. This is 0 except for user or infra issues. + // The request-level error code. This is 0 except for auth or infra issues. + // + // CLUSTER_AUTHORIZATION_FAILED if you do not have DESCRIBE on CLUSTER. ErrorCode: int16 // The request-level error message, if any. ErrorMessage: nullable-string @@ -24,6 +26,10 @@ DescribeUserSCRAMCredentialsResponse => // The name this result corresponds to. User: string // The user-level error code. + // + // RESOURCE_NOT_FOUND if the user does not exist or has no credentials. + // + // DUPLICATE_RESOURCE if the user is requested twice+. ErrorCode: int16 // The user-level error message, if any. ErrorMessage: nullable-string diff --git a/pkg/kmsg/generated.go b/pkg/kmsg/generated.go index 935279bd..c9c240cd 100644 --- a/pkg/kmsg/generated.go +++ b/pkg/kmsg/generated.go @@ -34543,6 +34543,10 @@ type DescribeUserSCRAMCredentialsResponseResult struct { User string // The user-level error code. + // + // RESOURCE_NOT_FOUND if the user does not exist or has no credentials. + // + // DUPLICATE_RESOURCE if the user is requested twice+. ErrorCode int16 // The user-level error message, if any. @@ -34578,7 +34582,9 @@ type DescribeUserSCRAMCredentialsResponse struct { // after responding to this request. ThrottleMillis int32 - // The request-level error code. This is 0 except for user or infra issues. + // The request-level error code. This is 0 except for auth or infra issues. + // + // CLUSTER_AUTHORIZATION_FAILED if you do not have DESCRIBE on CLUSTER. ErrorCode int16 // The request-level error message, if any. From 2655e1fec0bc533d1af51cc5ab6aa2a88c23e3e8 Mon Sep 17 00:00:00 2001 From: Travis Bischel Date: Wed, 20 Sep 2023 19:33:34 -0600 Subject: [PATCH 2/2] kadm: document missing topics being elided when listing topics --- pkg/kadm/metadata.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/kadm/metadata.go b/pkg/kadm/metadata.go index fcdc6612..f2797186 100644 --- a/pkg/kadm/metadata.go +++ b/pkg/kadm/metadata.go @@ -372,7 +372,9 @@ func (l ListedOffsets) KOffsets() map[string]map[int32]kgo.Offset { // ListStartOffsets returns the start (oldest) offsets for each partition in // each requested topic. In Kafka terms, this returns the log start offset. If -// no topics are specified, all topics are listed. +// no topics are specified, all topics are listed. If a requested topic does +// not exist, no offsets for it are listed and it is not present in the +// response. // // If any topics being listed do not exist, a special -1 partition is added // to the response with the expected error code kerr.UnknownTopicOrPartition. @@ -384,7 +386,8 @@ func (cl *Client) ListStartOffsets(ctx context.Context, topics ...string) (Liste // ListEndOffsets returns the end (newest) offsets for each partition in each // requested topic. In Kafka terms, this returns high watermarks. If no topics -// are specified, all topics are listed. +// are specified, all topics are listed. If a requested topic does not exist, +// no offsets for it are listed and it is not present in the response. // // If any topics being listed do not exist, a special -1 partition is added // to the response with the expected error code kerr.UnknownTopicOrPartition. @@ -399,7 +402,8 @@ func (cl *Client) ListEndOffsets(ctx context.Context, topics ...string) (ListedO // latest offset. In Kafka terms, committed means the last stable offset, and // newest means the high watermark. Record offsets in active, uncommitted // transactions will not be returned. If no topics are specified, all topics -// are listed. +// are listed. If a requested topic does not exist, no offsets for it are +// listed and it is not present in the response. // // If any topics being listed do not exist, a special -1 partition is added // to the response with the expected error code kerr.UnknownTopicOrPartition. @@ -414,6 +418,8 @@ func (cl *Client) ListCommittedOffsets(ctx context.Context, topics ...string) (L // returned from this function also include the timestamp of the offset. If no // topics are specified, all topics are listed. If a partition has no offsets // after the requested millisecond, the offset will be the current end offset. +// If a requested topic does not exist, no offsets for it are listed and it is +// not present in the response. // // If any topics being listed do not exist, a special -1 partition is added // to the response with the expected error code kerr.UnknownTopicOrPartition.