-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add namespaces permissions commands #71
Conversation
--- *Motivation* - Add commands `permissions` - Add commands `grant` - Add commands `revoke` - Add commands `grant-sub` - Add commands `revoke-sub`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please go through all the output, examples to make sure they are fixed based on the new command group and the new comments.
|
||
func GrantSubPermissionsCmd(vc *cmdutils.VerbCmd) { | ||
var desc LongDescription | ||
desc.CommandUsedFor = "This command is used for granting client roles to a subscription of a namespace." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
desc.CommandUsedFor = "This command is used for granting client roles to a subscription of a namespace." | |
desc.CommandUsedFor = "This command is used for granting a client role to access subscriptions of a namespace." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix all the examples and output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this command can grant some roles to a subscription. So update the description as granting client roles to access a subscription of a namespace
is better?
please fix the CI |
--- *Motivation* - Add commands `permissions` - Add commands `grant` - Add commands `revoke` - Add commands `grant-sub` - Add commands `revoke-sub` --- *OUTPUT* - permissions ``` USED FOR: This command is used for getting permissions configure data of a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Get permissions configure data of a namespace <tenant>/<namespace> pulsarctl namespaces permissions <tenant>/<namespace> OUTPUT: #normal output { "<role>": [ "<action>" ] } #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces permissions [flags] ``` - grant ``` USED FOR: This command is used for granting permissions to a client role on a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Grant permission <action> to the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces grant --role <role-name> --actions <action> <namespace-name> #Grant permissions <actions> to the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces grant --role <role-name> --actions <action-1> --actions <action-2> <namespace-name> OUTPUT: #normal output Grant permissions <actions> to the client role <role-name> on the namespace <namespace-name> successfully #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the authorization is not enabled [✖] code: 501 reason: Authorization is not enabled #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces grant [flags] Grant Permissions flags: --role string Client role to which grant permissions --actions strings Actions to be granted (produce,consume,functions) ``` - revoke ``` USED FOR: This command is used for revoking a client role permissions on a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions and broker has read-writer permissions on the zookeeper. EXAMPLES: #Revoke the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces revoke --role <role-name> <namespace-name> OUTPUT: #normal output Revoke the client role <role-name> permissions on the namespace <namespace-name> successfully #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces revoke [flags] Revoke Permissions flags: --role string Client role to which revoke permissions ``` - grant-sub ``` USED FOR: This command is used for granting client roles to a subscription of a namespace. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Grant client roles <roles-name> to the subscription <subscription-name> of the namespace <namespace-name> pulsarctl namespaces grant-sub --role <role1-name> --role <role2-name> <namespace-name> <subscription-name> OUTPUT: #normal output Grant client roles <role-name> to the subscription <subscription-name> of the namespace <namespace-name> successfully #the namespace name is not specified or the subscription name is not specified [✖] need to specified namespace name and subscription name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces grant-sub [flags] Grant Subscription Permissions flags: --role strings Client role to which grant permissions ``` - revoke-sub ``` USED FOR: This command is used for revoking a client role permissions on a subscription of a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions and broker has read-writer permissions on the zookeeper. EXAMPLES: #Revoke a client role <role-name> on the subscription <namespace-name> of the <namespace-name> pulsarctl namespaces revoke --role <role-name> <namespace-name> <subscription-name> OUTPUT: #normal output Revoke the client role <role-name> permissions on the subscription <subscription-name> of the namespace <namespace-name> successfully #the namespace name is not specified or the subscription name is not specified [✖] need to specified namespace name and subscription name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces revoke-sub [flags] Revoke Subscription Permissions flags: --role string Client role to which revoke permissions ```
--- *Motivation* - Add commands `permissions` - Add commands `grant` - Add commands `revoke` - Add commands `grant-sub` - Add commands `revoke-sub` --- *OUTPUT* - permissions ``` USED FOR: This command is used for getting permissions configure data of a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Get permissions configure data of a namespace <tenant>/<namespace> pulsarctl namespaces permissions <tenant>/<namespace> OUTPUT: #normal output { "<role>": [ "<action>" ] } #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces permissions [flags] ``` - grant ``` USED FOR: This command is used for granting permissions to a client role on a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Grant permission <action> to the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces grant --role <role-name> --actions <action> <namespace-name> #Grant permissions <actions> to the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces grant --role <role-name> --actions <action-1> --actions <action-2> <namespace-name> OUTPUT: #normal output Grant permissions <actions> to the client role <role-name> on the namespace <namespace-name> successfully #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the authorization is not enabled [✖] code: 501 reason: Authorization is not enabled #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces grant [flags] Grant Permissions flags: --role string Client role to which grant permissions --actions strings Actions to be granted (produce,consume,functions) ``` - revoke ``` USED FOR: This command is used for revoking a client role permissions on a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions and broker has read-writer permissions on the zookeeper. EXAMPLES: #Revoke the client role <role-name> on the namespace <namespace-name> pulsarctl namespaces revoke --role <role-name> <namespace-name> OUTPUT: #normal output Revoke the client role <role-name> permissions on the namespace <namespace-name> successfully #the namespace name is not specified [✖] only one argument is allowed to be used as a name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces revoke [flags] Revoke Permissions flags: --role string Client role to which revoke permissions ``` - grant-sub ``` USED FOR: This command is used for granting client roles to a subscription of a namespace. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Grant client roles <roles-name> to the subscription <subscription-name> of the namespace <namespace-name> pulsarctl namespaces grant-sub --role <role1-name> --role <role2-name> <namespace-name> <subscription-name> OUTPUT: #normal output Grant client roles <role-name> to the subscription <subscription-name> of the namespace <namespace-name> successfully #the namespace name is not specified or the subscription name is not specified [✖] need to specified namespace name and subscription name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces grant-sub [flags] Grant Subscription Permissions flags: --role strings Client role to which grant permissions ``` - revoke-sub ``` USED FOR: This command is used for revoking a client role permissions on a subscription of a namespace. REQUIRED PERMISSION: This command requires tenant admin permissions and broker has read-writer permissions on the zookeeper. EXAMPLES: #Revoke a client role <role-name> on the subscription <namespace-name> of the <namespace-name> pulsarctl namespaces revoke --role <role-name> <namespace-name> <subscription-name> OUTPUT: #normal output Revoke the client role <role-name> permissions on the subscription <subscription-name> of the namespace <namespace-name> successfully #the namespace name is not specified or the subscription name is not specified [✖] need to specified namespace name and subscription name #the namespace name is not in the format of <tenant>/<namespace> [✖] The complete name of namespace is invalid. complete name : <namespace-complete-name> #the tenant name and(or) namespace name is empty [✖] Invalid tenant or namespace. [<tenant>/<namespace>] #the tenant name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Tenant name include unsupported special chars. tenant : [<namespace>] #the namespace name contains unsupported special chars. the alphanumeric (a-zA-Z0-9) and the special chars (-=:.%) is allowed [✖] Namespace name include unsupported special chars. namespace : [<namespace>] Usage: pulsarctl namespaces revoke-sub [flags] Revoke Subscription Permissions flags: --role string Client role to which revoke permissions ```
Motivation
permissions
grant
revoke
grant-sub
revoke-sub
OUTPUT