Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/cmd/kafka/acl/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ func runAdmin(opts *options) (err error) {
kafkainstanceclient.ACLPERMISSIONTYPE_ALLOW,
)

opts.logger.Info(opts.localizer.MustLocalize("kafka.acl.grantPermissions.log.info.aclsPreview"))
rows := aclutil.MapACLsToTableRows([]kafkainstanceclient.AclBinding{*aclBindClusterAlter}, opts.localizer)

opts.logger.Info(opts.localizer.MustLocalizePlural("kafka.acl.grantPermissions.log.info.aclsPreview", len(rows)))
opts.logger.Info()

rows := aclutil.MapACLsToTableRows([]kafkainstanceclient.AclBinding{*aclBindClusterAlter}, opts.localizer)
dump.Table(opts.io.Out, rows)
opts.logger.Info()

Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/kafka/acl/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ func runAdd(instanceID string, opts *aclutil.CrudOptions) error {
kafkainstanceclient.AclPermissionType(requestParams.permission),
)

opts.Logger.Info(opts.Localizer.MustLocalize("kafka.acl.grantPermissions.log.info.aclsPreview"))
rows := aclutil.MapACLsToTableRows([]kafkainstanceclient.AclBinding{*newAclBinding}, opts.Localizer)

opts.Logger.Info(opts.Localizer.MustLocalizePlural("kafka.acl.grantPermissions.log.info.aclsPreview", len(rows)))
opts.Logger.Info()

rows := aclutil.MapACLsToTableRows([]kafkainstanceclient.AclBinding{*newAclBinding}, opts.Localizer)
dump.Table(opts.IO.Out, rows)
opts.Logger.Info()

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/kafka/acl/delete/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ func runDelete(instanceID string, opts *aclutil.CrudOptions) error {
localize.NewEntry("Count", deletedCount),
))

opts.Logger.Info(opts.Localizer.MustLocalize("kafka.acl.grantPermissions.log.delete.info.aclsPreview"))
opts.Logger.Info()
rows := aclutil.MapACLsToTableRows(*deletedACLs.Items, opts.Localizer)
opts.Logger.Info(opts.Localizer.MustLocalizePlural("kafka.acl.grantPermissions.log.delete.info.aclsPreview", len(rows)))
opts.Logger.Info()
dump.Table(opts.IO.Out, rows)
opts.Logger.Info()

Expand Down
5 changes: 3 additions & 2 deletions pkg/cmd/kafka/acl/grant/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,11 @@ func runGrantPermissions(opts *options) (err error) {
aclBindRequests = append(aclBindRequests, req.AclBinding(*aclBindTransactionIDDescribe))
}

opts.Logger.Info(opts.localizer.MustLocalize("kafka.acl.grantPermissions.log.info.aclsPreview"))
rows := aclutil.MapACLsToTableRows(aclBindingList, opts.localizer)

opts.Logger.Info(opts.localizer.MustLocalizePlural("kafka.acl.grantPermissions.log.info.aclsPreview", len(rows)))
opts.Logger.Info()

rows := aclutil.MapACLsToTableRows(aclBindingList, opts.localizer)
dump.Table(opts.IO.Out, rows)
opts.Logger.Info()

Expand Down
6 changes: 4 additions & 2 deletions pkg/localize/locales/en/cmd/acl.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,12 @@ one = 'Prefix name for topics to be selected'
one = 'Prefix name for groups to be selected'

[kafka.acl.grantPermissions.log.info.aclsPreview]
one = 'The following ACL rule is going to be created:'
one = 'The following ACL rule will be created:'
other = 'The following ACL rules will be created:'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice Pattern!


[kafka.acl.grantPermissions.log.delete.info.aclsPreview]
one = 'The following ACL rules were deleted:'
one = 'The following ACL rule was deleted:'
other = 'The following ACL rules were deleted:'

[kafka.acl.grantPermissions.log.info.aclsCreated]
one = 'ACLs successfully created in the Kafka instance "{{.InstanceName}}"'
Expand Down