yuruguo opened a new pull request #12412:
URL: https://github.com/apache/pulsar/pull/12412


   ### Motivation
   We should check the validity of the `--actions` and give a more friendly 
prompt message when granting permission to topic or namespace through 
`./bin/pulsar-admin topics grant-permission`.
   Currently, the lack of verification for `--action` will directly display the 
exception, as below:
   ```
   ./bin/pulsar-admin topics grant-permission tenant/ns/tp --role rl --actions 
producer
   java.lang.IllegalArgumentException: No enum constant 
org.apache.pulsar.common.policies.data.AuthAction.producer
        at java.lang.Enum.valueOf(Enum.java:238)
        at 
org.apache.pulsar.common.policies.data.AuthAction.valueOf(AuthAction.java:24)
        at 
org.apache.pulsar.admin.cli.CliCommand.getAuthActions(CliCommand.java:171)
        at 
org.apache.pulsar.admin.cli.CmdTopics$GrantPermissions.run(CmdTopics.java:293)
        at org.apache.pulsar.admin.cli.CmdBase.run(CmdBase.java:86)
        at 
org.apache.pulsar.admin.cli.PulsarAdminTool.run(PulsarAdminTool.java:282)
        at 
org.apache.pulsar.admin.cli.PulsarAdminTool.main(PulsarAdminTool.java:329)
   ```
   
   ### Modifications
   - Improve the description information of the `--action`
   - Throw `ParameterException` when `IllegalArgumentException` occurs when 
executing `AuthAction.valueOf(action)`
   
   ### Documentation
   Automatically generate doc through code
   - doc
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to