-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(kafka acl): add base and list command #1173
Conversation
|
||
[kafka.acl.cmd.example] | ||
one = ''' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this newline
|
||
[kafka.acl.cmd.longDescription] | ||
one = ''' | ||
Set of commands that will let you manage resources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set of commands that will let you manage resources | |
Set of commands that will let you manage resources. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe "Kafka instance resources"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, will make it Manage Kafka ACLs.
UI have numerous bugs logged in and still has some major development. I would not use it as a source of truth for the moment. |
|
||
cmd.Flags().Int32VarP(&opts.page, "page", "", cmdutil.ConvertPageValueToInt32(build.DefaultPageNumber), opts.localizer.MustLocalize("kafka.acl.list.flag.page.description")) | ||
cmd.Flags().Int32VarP(&opts.size, "size", "", cmdutil.ConvertSizeValueToInt32(build.DefaultPageSize), opts.localizer.MustLocalize("kafka.acl.list.flag.size.description")) | ||
cmd.Flags().StringVarP(&opts.output, "output", "o", "", opts.localizer.MustLocalize("kafka.acl.list.flag.output.description")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.Flags().StringVarP(&opts.output, "output", "o", "", opts.localizer.MustLocalize("kafka.acl.list.flag.output.description")) | |
cmd.Flags().StringVarP(&opts.output, "output", "o", dump.EmptyFormat, opts.localizer.MustLocalize("kafka.acl.list.flag.output.description")) |
pkg/cmd/kafka/acl/list/list.go
Outdated
req := api.AclsApi.GetAcls(opts.Context) | ||
|
||
req.Page(float32(opts.page)) | ||
|
||
req.Size(float32(opts.size)) | ||
|
||
permissionsData, httpRes, err := req.Execute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a matter of preference but this could be chained as it is a builder. Which do you prefer?
func formatPrincipal(principal string, localizer localize.Localizer) string { | ||
s := strings.Split(principal, ":")[1] | ||
|
||
if s == "*" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if s == "*" { | |
if s == acl.Wildcard { |
Something like this will be useful.
Either way, I was expecting the last created ACL to appear at the bottom. How is it determined? |
## Display Kafka ACL rules for the instance | ||
rhoas kafka acl list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Display Kafka ACL rules for the instance | |
rhoas kafka acl list | |
# Display Kafka ACL rules for the instance | |
$ rhoas kafka acl list |
|
||
|
||
[kafka.acl.list.flag.output.description] | ||
description = "Description for --output flag" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
descriptions of flag i18n messages are redundant. Could be removed
Permission: fmt.Sprintf("%s | %s", p.GetPermission(), p.GetOperation()), | ||
Description: fmt.Sprintf("%s %s \"%s\"", p.GetResourceType(), description, p.GetResourceName()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should map raw ACL values to something more human readable. Example GROUP => Consumer Group, CLUSTER => Kafka instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep them as in spec and aligned with the way our documentation will cover them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah makes sense.
pkg/cmd/kafka/acl/list/list.go
Outdated
req.Page(float32(opts.page)) | ||
|
||
req.Size(float32(opts.size)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These values are not being included because you need to use a builder or else reassign to reg
like req = req.*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's address this if possible in this PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Will merge it for now and raise a follow up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good except pagination is not working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rkpattnaik780 can you merge this and follow up on the comments in another PR (maybe create issues to track them). I need this closed as it included the base command.
Nice to have and great way to wrap your head around API. @rkpattnaik780 @craicoverflow let's release SDK as well - we basing on non recent changes which might cause some issues in some API's (incompatible changes were made) |
This PR adds
rhoas kafka acl list
command to list all the Kafka ACL rules for a given instance.Closes #1172
Verification Steps
rhoas kafka -h
should displayacl
in list of sub commandsrhoas kafka acl list
should display ACL rules for the selected Kafka instance.Type of change
Checklist