feat(kafka): manage topic access grants - #773
Conversation
📝 Changelog previewBelow is a preview of the Changelog that will be added to the next release. Only commit messages that follow the Conventional Commits specification will be included in the Changelog. v5.49.0 - 2026-09-10Full Changelog: v5.48.0...v5.49.0 🚀 Features
|
There was a problem hiding this comment.
🟡 Changes recommended
The new revoke-grant command has avoidable UX/API inconsistencies (argument order vs grant-access and validation placement) that should be addressed before merging.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds Kafka topic access grant management capabilities to the CLI by introducing commands to list and revoke ACL grants, backed by new GraphQL query/mutation support.
Changes:
- Add
kafka list-grantsto display ACL grants for a Kafka topic (table or JSON output). - Add
kafka revoke-grantto revoke a specific subject’s access level on a Kafka topic, including grant-aware autocompletion. - Extend generated GraphQL client code for fetching grants and revoking them; remove leftover debug dumping in config code.
File summaries
| File | Description |
|---|---|
| internal/naisapi/gql/generated.go | Adds genqlient-generated types and operations for GetKafkaTopicGrants and RevokeAccessFromKafkaTopic. |
| internal/kafka/kafka.go | Introduces Grant model plus API helpers to list grants and revoke a grant via GraphQL. |
| internal/kafka/command/revoke_grant.go | New kafka revoke-grant command and grant-aware argument autocompletion. |
| internal/kafka/command/list_grants.go | New kafka list-grants command for listing topic ACL entries. |
| internal/kafka/command/list_grants_test.go | Adds tests for the new commands and grant table headings. |
| internal/kafka/command/flag/flag.go | Tightens access validation (reject empty) and adds ListGrants flags. |
| internal/kafka/command/command.go | Registers new subcommands and adds topic name autocompletion helper. |
| internal/config/config.go | Removes accidental debug spew.Dump usage. |
Review details
- Files reviewed: 8/8 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| ValidateFunc: validation.RequireTeamAndEnvironment(parentFlags), | ||
| AutoCompleteFunc: autoCompleteKafkaGrantArguments(parentFlags), | ||
| RunFunc: func(ctx context.Context, args *naistrix.Arguments, out *naistrix.OutputWriter) error { | ||
| topicName := args.Get("topic") | ||
| subject := kafkaApplicationName(args.Get("username")) | ||
| access := flag.KafkaTopicGrantAccess(args.Get("access")) | ||
| if err := access.Validate(); err != nil { | ||
| return err | ||
| } |
| Args: []naistrix.Argument{ | ||
| {Name: "topic"}, | ||
| {Name: "username"}, | ||
| {Name: "access"}, | ||
| }, |
No description provided.