feat(acl list): add flags to filter by resource#1299
Conversation
|
Verified/Reviewed. Changes look good. Pinging @craicoverflow as another SME for correctness |
craicoverflow
left a comment
There was a problem hiding this comment.
Some changes needed. Left a comment regarding whether --cluster is needed.
pkg/cmd/kafka/acl/list/list.go
Outdated
| flags.AddTopic(&opts.topic) | ||
| flags.AddConsumerGroup(&opts.group) |
There was a problem hiding this comment.
We need to add dynamic completions for these.
There was a problem hiding this comment.
Will it be good to add an additional field factory in the flagSet struct? That will make it easier to reuse completions for topic and group from cmdutils?
There was a problem hiding this comment.
Yeah, that would be a good move. You can remove the localizer and conn fields so and just use this :)
I'd recommend refactoring these completions APIs also to look like this one:
They also probably should not be in a generic cmdutil package since they are kafka specific (I did that 😂)
|
This is ready for review @rkpattnaik780? |
Yes. |
Thanks. |
|
Documentation needs little bit refinement: Set filter to all-accounts etc. Current docs are less refined |
|
Documentation needs improvement. Otherwise ok. |
Falling back to not using flag abstraction here as the descriptions differ a bit owing to |
7a212dd to
e292865
Compare
|
Having second thoughts adding a prefix regarding filter operation, wdyt @craicoverflow ? |
craicoverflow
left a comment
There was a problem hiding this comment.
All looks good and works. However I noticed that the cluster flag still exists and I think we agreed it is not a requirement.
| flagName, | ||
| "", | ||
| fs.localizer.MustLocalize("kafka.acl.common.flag.transactionalID.description"), | ||
| fs.factory.Localizer.MustLocalize("kafka.acl.common.flag.transactionalID.description"), |
There was a problem hiding this comment.
nit: It may be good to create a local variable to save having to access this nested all the time
|
|
||
| // FilterValidTopicNameArgs filters topics from the API and returns the names | ||
| // This is used in for dynamic completion of topic names | ||
| func FilterValidTopicNameArgs(f *factory.Factory, toComplete string) (validNames []string, directive cobra.ShellCompDirective) { |
There was a problem hiding this comment.
nit: these could go in kafka flag util package?
User should be able to list the ACLs per Cluster, Topic or Group.
A small bug fix to ACL list
Verification Steps
Type of change
Checklist