@@ -33,17 +33,17 @@ type options struct {
3333 localizer localize.Localizer
3434 Context context.Context
3535
36- kafkaID string
37- topic string
38- user string
39- svcAccount string
40- group string
41- producer bool
42- consumer bool
43- topicPrefix string
44- groupPrefix string
45- force bool
46- allPrincipals bool
36+ kafkaID string
37+ topic string
38+ user string
39+ svcAccount string
40+ group string
41+ producer bool
42+ consumer bool
43+ topicPrefix string
44+ groupPrefix string
45+ force bool
46+ allAccounts bool
4747}
4848
4949// NewGrantPermissionsACLCommand creates a series of ACL rules
@@ -97,9 +97,9 @@ func NewGrantPermissionsACLCommand(f *factory.Factory) *cobra.Command {
9797 cmd .Flags ().BoolVar (& opts .producer , "producer" , false , opts .localizer .MustLocalize ("kafka.acl.grantPermissions.flag.producer.description" ))
9898 cmd .Flags ().StringVar (& opts .topicPrefix , "topic-prefix" , "" , opts .localizer .MustLocalize ("kafka.acl.common.flag.topicPrefix.description" ))
9999 cmd .Flags ().StringVar (& opts .groupPrefix , "group-prefix" , "" , opts .localizer .MustLocalize ("kafka.acl.common.flag.groupPrefix.description" ))
100- cmd .Flags ().StringVar (& opts .kafkaID , "instance-id" , "" , opts .localizer .MustLocalize ("kafka.acl.common.flag.instance.id" ))
101- cmd .Flags ().BoolVar (& opts .allPrincipals , "all-principals " , false , opts .localizer .MustLocalize ("kafka.acl.common.flag.allPrincipals " ))
102- cmd .Flags ().BoolVarP (& opts .force , "yes" , "y" , false , opts .localizer .MustLocalize ("kafka.acl.grantPermissions.flag.yes" ))
100+ cmd .Flags ().StringVar (& opts .kafkaID , "instance-id" , "" , opts .localizer .MustLocalize ("kafka.acl.common.flag.instance.id.description " ))
101+ cmd .Flags ().BoolVar (& opts .allAccounts , "all-accounts " , false , opts .localizer .MustLocalize ("kafka.acl.common.flag.allAccounts.description " ))
102+ cmd .Flags ().BoolVarP (& opts .force , "yes" , "y" , false , opts .localizer .MustLocalize ("kafka.acl.grantPermissions.flag.yes.description " ))
103103
104104 return cmd
105105}
@@ -151,7 +151,7 @@ func runGrantPermissions(opts *options) (err error) {
151151 userArg = buildPrincipal (opts .user )
152152 }
153153
154- if opts .allPrincipals {
154+ if opts .allAccounts {
155155 userArg = buildPrincipal (acl .Wildcard )
156156 }
157157
@@ -316,7 +316,7 @@ func validateFlagInputCombination(opts *options) error {
316316 }
317317
318318 // check if priincipal is provided
319- if opts .user == "" && opts .svcAccount == "" && ! opts .allPrincipals {
319+ if opts .user == "" && opts .svcAccount == "" && ! opts .allAccounts {
320320 return opts .localizer .MustLocalizeError ("kafka.acl.grantPermissions.error.noPrincipalsSelected" )
321321 }
322322
@@ -325,8 +325,8 @@ func validateFlagInputCombination(opts *options) error {
325325 return opts .localizer .MustLocalizeError ("kafka.acl.grantPermissions.error.bothPrincipalsSelected" )
326326 }
327327
328- // user and service account can't be along with "--all-principals " flag
329- if opts .allPrincipals && (opts .svcAccount != "" || opts .user != "" ) {
328+ // user and service account can't be along with "--all-accounts " flag
329+ if opts .allAccounts && (opts .svcAccount != "" || opts .user != "" ) {
330330 return opts .localizer .MustLocalizeError ("kafka.acl.grantPermissions.allPrinciapls.error.notAllowed" )
331331 }
332332
0 commit comments