Add namespaces permissions commands - #71
Merged
Merged
Conversation
--- *Motivation* - Add commands `permissions` - Add commands `grant` - Add commands `revoke` - Add commands `grant-sub` - Add commands `revoke-sub`
sijie
requested changes
Sep 24, 2019
sijie
left a comment
Member
There was a problem hiding this comment.
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." |
Member
There was a problem hiding this comment.
Suggested change
| 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." |
Member
There was a problem hiding this comment.
Please fix all the examples and output
Member
Author
There was a problem hiding this comment.
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?
Member
|
please fix the CI |
sijie
approved these changes
Oct 10, 2019
tisonkun
pushed a commit
to tisonkun/pulsar-client-go
that referenced
this pull request
Aug 15, 2023
---
*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
```
tisonkun
pushed a commit
to apache/pulsar-client-go
that referenced
this pull request
Aug 16, 2023
---
*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
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
permissionsgrantrevokegrant-subrevoke-subOUTPUT