feat(kafka acl): add base and list command#1173
Conversation
|
|
||
| [kafka.acl.cmd.example] | ||
| one = ''' | ||
|
|
|
|
||
| [kafka.acl.cmd.longDescription] | ||
| one = ''' | ||
| Set of commands that will let you manage resources |
There was a problem hiding this comment.
| 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.
Maybe "Kafka instance resources"?
There was a problem hiding this comment.
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.
| 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")) |
| 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.
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.
| 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.
| ## 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.
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.
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.
I would keep them as in spec and aligned with the way our documentation will cover them
There was a problem hiding this comment.
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.
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.
Let's address this if possible in this PR!
There was a problem hiding this comment.
Done. Will merge it for now and raise a follow up.
craicoverflow
left a comment
There was a problem hiding this comment.
All good except pagination is not working.
craicoverflow
left a comment
There was a problem hiding this comment.
@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 listcommand to list all the Kafka ACL rules for a given instance.Closes #1172
Verification Steps
rhoas kafka -hshould displayaclin list of sub commandsrhoas kafka acl listshould display ACL rules for the selected Kafka instance.Type of change
Checklist