Add partitioned topic command CURD - #35
Merged
Merged
Conversation
zymap
requested review from
sijie and
wolfstudy
and removed request for
wolfstudy
September 5, 2019 15:05
Member
|
please avoid coupling refactoring with other changes. so revert the refactor please. also as discussed, lets unify partitioned topic and topic into one set of commands. |
zymap
force-pushed
the
topic-partitioned-commands
branch
from
September 7, 2019 06:35
383dac2 to
f70a8ec
Compare
Member
Author
|
@sijie PTAL |
sijie
requested changes
Sep 9, 2019
sijie
left a comment
Member
There was a problem hiding this comment.
Please add the help output for the added commands in the description.
zymap
force-pushed
the
topic-partitioned-commands
branch
from
September 9, 2019 15:48
d4986f6 to
b213f04
Compare
sijie
requested changes
Sep 9, 2019
| return err | ||
| } | ||
|
|
||
| partitions, err := strconv.Atoi(vc.NameArgs[1]) |
Member
There was a problem hiding this comment.
It is only checking two args. Please be more specific. SetRunFuncWithTwoNameArgs
Member
Author
|
@sijie PTAL |
sijie
approved these changes
Sep 10, 2019
tisonkun
pushed a commit
to tisonkun/pulsar-client-go
that referenced
this pull request
Aug 15, 2023
Master issue: streamnative/pulsarctl#2 *Modifications* Add commands topic `create`, `delete`, `update`, `get-metadata`, `list`. *TODO* need add test for these commands. ## OUTPUT * create * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic create -h USED FOR: This command is used for creating topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Create non-partitioned topic <topic-name> pulsarctl topics create <topic-name> 0 #Create topic <topic-name> with <partitions-num> partitions pulsarctl topics create <topic-name> <partition-num> OUTPUT: #normal output Create topic <topic-name> with <partition-num> partitions successfully #the topic name and(or) the partitions is not specified [✖] need to specified the topic name and the partitions #the topic has been created [✖] code: 409 reason: Partitioned topic already exists #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics create [flags] Aliases: create, c ``` * delete * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic delete -h USED FOR: This command is used for deleting an exist topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Delete a partitioned topic <topic-name> pulsarctl topics delete <topic-name> #Delete a non-partitioned topic <topic-name> pulsarctl topics delete --non-partitioned <topic-name> OUTPUT: #normal output Delete topic <topic-name> successfully #the topic name is not specified [✖] only one argument is allowed to be used as a name #the partitioned topic does not exist [✖] code: 404 reason: Partitioned topic does not exist #the non-partitioned topic does not exist [✖] code: 404 reason: Topic not found #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics delete [flags] Aliases: delete, d ``` * get-metadata * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic get-metadata -h USED FOR: This command is used for getting an exist topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Get an exist topic <topic-name> metadata pulsarctl topics get-metadata <topic-name> OUTPUT: #normal output { "partitions": "<partitions>" } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics get-metadata [flags] Aliases: get-metadata, gm ``` * list * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic list -h USED FOR: This command is used for listing all exist topics under the specified namespace. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #List all exist topics under the namespace <tenant/namespace> pulsarctl topics list <tenant/namespace> OUTPUT: #normal output +--------------------------------+--------------------------------+ | PUBLIC/DEFAULT PARTITIONED | PUBLIC/DEFAULT NON-PARTITIONED | | TOPICS | TOPICS | +--------------------------------+--------------------------------+ | | | +--------------------------------+--------------------------------+ #the namespace is not specified [✖] only one argument is allowed to be used as a name #the tenant of the namespace is not exist [✖] code: 404 reason: Tenant does not exist #the namespace is not exist [✖] code: 404 reason: Namespace does not exist #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 topics list [flags] Aliases: list, lp ``` * update * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic update -h USED FOR: This command is used for updating an exist topic with new partition number. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: # pulsarctl topics update <topic-name> <partition-num> OUTPUT: #normal output Update topic <topic-name> with <partition-num> partitions successfully #the topic name and(or) the partitions is not specified [✖] need to specified the topic name and the partitions #the partitions number is invalid [✖] invalid partition number '<number>' #the topic is not exist [✖] code: 409 reason: Topic is not partitioned topic #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics update [flags] Aliases: update, up ```
tisonkun
pushed a commit
to apache/pulsar-client-go
that referenced
this pull request
Aug 16, 2023
Master issue: streamnative/pulsarctl#2 *Modifications* Add commands topic `create`, `delete`, `update`, `get-metadata`, `list`. *TODO* need add test for these commands. ## OUTPUT * create * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic create -h USED FOR: This command is used for creating topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Create non-partitioned topic <topic-name> pulsarctl topics create <topic-name> 0 #Create topic <topic-name> with <partitions-num> partitions pulsarctl topics create <topic-name> <partition-num> OUTPUT: #normal output Create topic <topic-name> with <partition-num> partitions successfully #the topic name and(or) the partitions is not specified [✖] need to specified the topic name and the partitions #the topic has been created [✖] code: 409 reason: Partitioned topic already exists #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics create [flags] Aliases: create, c ``` * delete * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic delete -h USED FOR: This command is used for deleting an exist topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Delete a partitioned topic <topic-name> pulsarctl topics delete <topic-name> #Delete a non-partitioned topic <topic-name> pulsarctl topics delete --non-partitioned <topic-name> OUTPUT: #normal output Delete topic <topic-name> successfully #the topic name is not specified [✖] only one argument is allowed to be used as a name #the partitioned topic does not exist [✖] code: 404 reason: Partitioned topic does not exist #the non-partitioned topic does not exist [✖] code: 404 reason: Topic not found #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics delete [flags] Aliases: delete, d ``` * get-metadata * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic get-metadata -h USED FOR: This command is used for getting an exist topic. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #Get an exist topic <topic-name> metadata pulsarctl topics get-metadata <topic-name> OUTPUT: #normal output { "partitions": "<partitions>" } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics get-metadata [flags] Aliases: get-metadata, gm ``` * list * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic list -h USED FOR: This command is used for listing all exist topics under the specified namespace. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: #List all exist topics under the namespace <tenant/namespace> pulsarctl topics list <tenant/namespace> OUTPUT: #normal output +--------------------------------+--------------------------------+ | PUBLIC/DEFAULT PARTITIONED | PUBLIC/DEFAULT NON-PARTITIONED | | TOPICS | TOPICS | +--------------------------------+--------------------------------+ | | | +--------------------------------+--------------------------------+ #the namespace is not specified [✖] only one argument is allowed to be used as a name #the tenant of the namespace is not exist [✖] code: 404 reason: Tenant does not exist #the namespace is not exist [✖] code: 404 reason: Namespace does not exist #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 topics list [flags] Aliases: list, lp ``` * update * ``` ➜ pulsarctl-yong git:(topic-partitioned-commands) ./pulsarctl topic update -h USED FOR: This command is used for updating an exist topic with new partition number. REQUIRED PERMISSION: This command requires admin permissions. EXAMPLES: # pulsarctl topics update <topic-name> <partition-num> OUTPUT: #normal output Update topic <topic-name> with <partition-num> partitions successfully #the topic name and(or) the partitions is not specified [✖] need to specified the topic name and the partitions #the partitions number is invalid [✖] invalid partition number '<number>' #the topic is not exist [✖] code: 409 reason: Topic is not partitioned topic #the topic name is not in the format of <tenant>/<namespace>/<topic> or <topic> [✖] Invalid short topic name '<topic-name>', it should be in the format of <tenant>/<namespace>/<topic> or <topic> #the topic name is not in the format of <domain>://<tenant>/<namespace>/<topic> [✖] Invalid complete topic name '<topic-name>', it should be in the format of <domain>://<tenant>/<namespace>/<topic> #the topic name is not in the format of <tenant>/<namespace>/<topic> [✖] Invalid topic name '<topic-name>', it should be in the format of<tenant>/<namespace>/<topic> #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 topics update [flags] Aliases: update, up ```
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.
Master issue: #2
Modifications
Add commands topic
create,delete,update,get-metadata,list.TODO
need add test for these commands.
OUTPUT