This repository has been archived by the owner on Aug 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Conversation
This file contains 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
Signed-off-by: Max Xu <xuhuan@live.cn>
FushuWang
approved these changes
Mar 14, 2023
You can follow the Single Responsibility Principle, but we should also add the factory method to create the authentication provider in the You can see pulsar-client-go. |
maxsxu
pushed a commit
that referenced
this pull request
Mar 14, 2023
maxsxu
added a commit
that referenced
this pull request
Mar 14, 2023
chore: decouple config and auth package Signed-off-by: Max Xu <xuhuan@live.cn>
maxsxu
added a commit
that referenced
this pull request
Mar 17, 2023
* Initialize the pulsarctl project (#1) * Initialize the pulsarctl project *Modifications* - setup the project layout - add two clusters command * Add post request for project (#7) Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> Add post request for project * Add cluster commands `get` (#4) Add cluster commands `get` * Make API version configurable (#16) *Motivation* Pulsar admin requests will use different API version to request broker. So we need to make the API version configurable. *Modifications* - Provide an API version to use. - Send requests with different API version settings. * Add auth logic for `pulsarctl` (#20) Master Issue: #2 Add auth logic for `pulsarctl` * Add command cluster `update` (#17) Master issue: #2 ``` ➜ pulsarctl git:(cluster_update) ✗ ./pulsarctl clusters update -h USED FOR: This command is used for updating the cluster data of the specified cluster. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #updating the web service url of the <cluster-name> pulsarctl clusters update --url http://example:8080 <cluster-name> #updating the tls secured web service url of the <cluster-name> pulsarctl clusters update --url-tls https://example:8080 <cluster-name> #updating the broker service url of the <cluster-name> pulsarctl clusters update --broker-url pulsar://example:6650 <cluster-name> #updating the tls secured web service url of the <cluster-name> pulsarctl clusters update --broker-url-tls pulsar+ssl://example:6650 <cluster-name> #registered as a peer-cluster of the <cluster-name> clusters pulsarctl clusters update -p <cluster-a>,<cluster-b> <cluster> OUTPUT: #normal output Cluster <cluster-name> updated #output of doesn't specified a cluster name [✖] only one argument is allowed to be used as a name #Output of cluster doesn't exist [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters update [flags] Aliases: update, update ClusterData flags: --url string Pulsar cluster web service url, e.g. http://example.pulsar.io:8080 --url-tls string Pulsar cluster tls secured web service url, e.g. https://example.pulsar.io:8443 --broker-url string Pulsar cluster broker service url, e.g. pulsar://example.pulsar.io:6650 --broker-url-tls string Pulsar cluster tls secured broker service url, e.g. pulsar+ssl://example.pulsar.io:6651 -p, --peer-cluster stringArray Cluster to be registered as a peer-cluster of this cluster. Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters update [command] --help' for more information about a command. ``` * Add command cluster `update-peer-clusters` (#18) Master issue: #2 output : ``` USED FOR: This command is used for updating peer clusters. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #updating the <cluster-name> peer clusters pulsarctl clusters update-peer-clusters -p cluster-a,cluster-b <cluster-name> OUTPUT: #normal output <cluster-name> peer clusters updated #output of doesn't specified a cluster name [✖] only one argument is allowed to be used as a name #output of cluster doesn't exist [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters update-peer-clusters [flags] Aliases: update-peer-clusters, upc Update peer clusters flags: -p, --peer-cluster stringArray Cluster to be registered as a peer-cluster of this cluster Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters update-peer-clusters [command] --help' for more information about a command. ``` * Add command cluster `get-peer-clusters` (#19) * Add command cluster `get-peer-clusters` --- Master Issue: #2 * Fix long description * Add create cmd of Pulsar Functions (#15) Add create cmd of Pulsar Functions * Add stop cmd for Pulsar Functions (#25) Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add command cluster `create-failure-domain` (#21) Master issue: #2 ``` USED FOR: This command is used for creating a failure domain of the <cluster-name>. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #creating the failure domain pulsarctl clusters create-failure-domain <cluster-name> <domain-name> #creating the failure domain with brokers pulsarctl clusters create-failure-domain --broker-list <cluster-A> --broker-list <cluster-B> <cluster-name> <domain-name> OUTPUT: #normal output Create failure domain <domain-name> for cluster <cluster-name> succeed #the args need to be specified as <cluster-name> <domain-name> [✖] need specified two names for cluster and failure domain #the specified cluster does not exist in the broker [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters create-failure-domain [flags] Aliases: create-failure-domain, cfd FailureDomainData flags: -b, --broker-list strings Set the failure domain clusters Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") --auth-params string Authentication parameters are used to configure the public and private key files required by tls For example: "tlsCertFile:val1,tlsKeyFile:val2" -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command --tls-allow-insecure Allow TLS insecure connection --tls-trust-cert-pat string Allow TLS trust cert file path -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters create-failure-domain [command] --help' for more information about a command. ``` * Add delete cmd for Pulsar Functions (#26) Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> Master Issue: #2 Add delete cmd for Pulsar Functions, the output as follows: ``` USED FOR: This command is used for delete a Pulsar Function that is running on a Pulsar cluster. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Delete a Pulsar Function that is running on a Pulsar cluster pulsarctl functions create --tenant public --namespace default --name <the name of Pulsar Functions> #Delete a Pulsar Function that is running on a Pulsar cluster with instance ID pulsarctl functions create --tenant public --namespace default --name <the name of Pulsar Functions> --instance-id 1 #Delete a Pulsar Function that is running on a Pulsar cluster with FQFN pulsarctl functions delete --fqfn tenant/namespace/name [eg: public/default/ExampleFunctions] OUTPUT: #normal output Deleted successfully Usage: pulsarctl functions delete [flags] Aliases: delete, delete FunctionsConfig flags: --fqfn string The Fully Qualified Function Name (FQFN) for the function --tenant string The tenant of a Pulsar Function --namespace string The namespace of a Pulsar Function --name string The name of a Pulsar Function ``` * Add command cluster `get-failure-domain` (#22) Master issue: #2 output example: ``` ➜ pulsarctl git:(clusters_get_failure_domain) ./pulsarctl cluster get-failure-domain -h USED FOR: This command is used for getting the specified failure domain on the specified cluster. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #getting the broker list in the <cluster-name> cluster failure domain <domain-name> pulsarctl clusters get-failure-domain -n <domain-name> <cluster-name> OUTPUT: #output example { "brokers" : [ "failure-broker-A", "failure-broker-B", ] } #the cluster name is not specified or the cluster name is specified more than one [✖] only one argument is allowed to be used as a name #the specified cluster does not exist in the broker [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters get-failure-domain [flags] Aliases: get-failure-domain, gfd FailureDomain flags: -n, --domain-name string The failure domain name Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters get-failure-domain [command] --help' for more information about a command. ``` * Add start cmd for Pulsar Functions (#29) Master Issue: #2 Add start cmd for Pulsar Functions ``` USED FOR: This command is used for starting a stopped function instance. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Starts a stopped function instance pulsarctl functions start --tenant public --namespace default --name <the name of Pulsar Function> #Starts a stopped function instance with instance ID pulsarctl functions start --tenant public --namespace default --name <the name of Pulsar Function> --instance-id 1 #Starts a stopped function instance with FQFN pulsarctl functions start --fqfn tenant/namespace/name [eg: public/default/ExampleFunctions] OUTPUT: #normal output Started successfully #You must specify a name for the Pulsar Functions or a FQFN, please check the --name args [✖] you must specify a name for the function or a Fully Qualified Function Name (FQFN) #The name of Pulsar Functions doesn't exist, please check the --name args [✖] code: 404 reason: Function <your function name> doesn't exist #Used an instanceID that does not exist or other impermissible actions [✖] code: 400 reason: Operation not permitted Usage: pulsarctl functions start [flags] Aliases: start, start FunctionsConfig flags: --fqfn string The Fully Qualified Function Name (FQFN) for the function --tenant string The tenant of a Pulsar Function --namespace string The namespace of a Pulsar Function --name string The name of a Pulsar Function --instance-id string The function instanceId (start all instances if instance-id is not provided) ``` * Add command cluster `list-failure-domains` (#23) Master issue: #2 ``` ➜ pulsarctl git:(clusters_list_failure_domain) ./pulsarctl cluster list-failure-domains -h USED FOR: This command is used for getting all failure domain under the cluster <cluster-name>. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #listing all the failure domains under the specified cluster pulsarctl clusters list-failure-domains <cluster-name> OUTPUT: #output example { "failure-domain": { "brokers": [ "failure-broker-A", "failure-broker-B" ] } } #the cluster name is not specified or the cluster name is specified more than one [✖] only one argument is allowed to be used as a name #the specified cluster does not exist in the broker [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters list-failure-domains [flags] Aliases: list-failure-domains, lfd Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") --auth-params string Authentication parameters are used to configure the public and private key files required by tls For example: "tlsCertFile:val1,tlsKeyFile:val2" -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command --tls-allow-insecure Allow TLS insecure connection --tls-trust-cert-pat string Allow TLS trust cert file path -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters list-failure-domains [command] --help' for more information about a command. ``` * Add restart, list and get cmd for Pulsar Functions (#30) Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add restart cmd for Pulsar Functions Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add list cmd for Pulsar Functions Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add get cmd for Pulsar functions Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add update cmd for Pulsar Functions (#33) Add update cmd for Pulsar Functions, output as follows: ``` USED FOR: Update a Pulsar Function that has been deployed to a Pulsar cluster. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Update output topic of Pulsar Function pulsarctl functions update --tenant public --namespace default --name update-function --output test-output-topic #Update function config yaml file of Pulsar Function pulsarctl functions update --function-config-file <the path of function config yaml file> --jar <the path of user code jar> #Update log topic of Pulsar Function pulsarctl functions update --log-topic persistent://public/default/test-log-topic # Other function parameters #Update dead letter topic of Pulsar Function pulsarctl functions update --dead-letter-topic persistent://public/default/test-dead-letter-topic --max-message-retries 10 # Other function parameters #Update user config of Pulsar Function pulsarctl functions update --user-config "{"publishTopic":"publishTopic", "key":"pulsar"}" # Other function parameters #Update custom schema of inputs topic for Pulsar Function pulsarctl functions update --custom-schema-inputs "{"topic-1":"schema.STRING", "topic-2":"schema.JSON"}" # Other function parameters #Update schema type of output topic for Pulsar Function pulsarctl functions update --schema-type schema.STRING # Other function parameters #Update parallelism of Pulsar Function pulsarctl functions update --parallelism 1 # Other function parameters #Update resource of Pulsar Function pulsarctl functions update --ram 5656565656 --disk 8080808080808080 --cpu 5.0 # Other function parameters #Update window functions config of Pulsar Function pulsarctl functions update --window-length-count 10 --window-length-duration-ms 1000 --sliding-interval-count 3 --sliding-interval-duration-ms 1000 # Other function parameters OUTPUT: #normal output Updated successfully #Update contains no change [✖] code: 400 reason: Update contains no change #The name of Pulsar Functions doesn't exist, please check the --name args [✖] code: 404 reason: Function <your function name> doesn't exist Usage: pulsarctl functions update [flags] Aliases: update, update ``` * Add command cluster `delete-failure-domain` (#24) Master issue: #2 ``` ➜ pulsarctl git:(clusters_delete_failure_domain) ./pulsarctl cluster delete-failure-domain -h USED FOR: This command is used for deleting the failure domain <domain-name> of the cluster <cluster-name> REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #deleting the failure domain pulsarctl clusters delete-failure-domain --domain-name <domain-name> <cluster-name> OUTPUT: #output example Delete failure domain [<domain-name>] for cluster [<cluster-name>] succeed #the cluster name is not specified or the cluster name is specified more than one [✖] only one argument is allowed to be used as a name #the specified cluster does not exist in the broker [✖] code: 404 reason: Cluster does not exist Usage: pulsarctl clusters delete-failure-domain [flags] Aliases: delete-failure-domain, dfd FailureDomainData flags: -n, --domain-name string The failure domain name Common flags: -s, --admin-service-url string The admin web service url that pulsarctl connects to. (default "http://localhost:8080") -C, --color string toggle colorized logs (true,false,fabulous) (default "true") -h, --help help for this command -v, --verbose int set log level, use 0 to silence, 4 for debugging (default 3) Use 'pulsarctl clusters delete-failure-domain [command] --help' for more information about a command. ``` * Add namespace and topic name check (#37) Add namespace and topic name check * Add more tests and add encode topic method (#38) * Add command cluster `update_failure_domain` (#36) master issue: #2 * Add tenants related commands (#28) Master issue: #2 The pull requests add all tenant commands. * Add stats, status, querystate, putstate, trigger cmds for Pulsar Functions (#34) Master Issue: #2 Add `stats`, `status`, `querystate`, `putstate`, `trigger` cmds for Pulsar Functions * Add partitioned topic command CURD (#35) Master issue: #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 ``` * Add source command for pulsarctl (#45) Signed-off-by: xiaolong.ran ranxiaolong716@gmail.com Add source command for pulsarctl - createSourcesCmd - updateSourcesCmd - deleteSourcesCmd - getSourcesCmd - listSourcesCmd - stopSourcesCmd - startSourcesCmd - restartSourcesCmd - statusSourcesCmd * [issue:50] fix response status code error (#53) * [issue:50] fix response status code error Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add command topic `lookup` and `bundle-range` (#44) ## OUTPUT *lookup* ``` ➜ pulsarctl-yong git:(topic-lookup) ✗ ./pulsarctl topic lookup -h USED FOR: This command is used for looking up a topic. REQUIRED PERMISSION: This command does not require permissions. EXAMPLES: #Look up a topic <topic-name> pulsarctl topic lookup <topic-name> OUTPUT: # { "brokerUlr": "", "brokerUrlTls": "", "httpUrl": "", "httpUrlTls": "", } #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 lookup [flags] ``` *bundle-range* ``` ➜ pulsarctl-yong git:(topic-lookup) ✗ ./pulsarctl topic bundle-range -h USED FOR: This command is used for getting namespace bundle range of a topic. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Get namespace bundle range of a topic <topic-name> pulsarctl topic bundle-range <topic-name> OUTPUT: #normal output The bundle range of the topic <topic-name> is: <bundle-range> #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 bundle-range [flags] Aliases: bundle-range, ``` * Add schemas commands for pulsarctl (#52) * Add schemas commands foor pulsarctl Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add sink commands for pulsarctl (#47) Add sink commands for pulsarctl - createSinksCmd - updateSinksCmd - deleteSinksCmd - getSinksCmd - listSinksCmd - stopSinksCmd - startSinksCmd - restartSinksCmd - statusSinksCmd * Add command topic `last-message-id` (#42) Master Issue: #2 ##OUTPUT *last-message-id* ``` ➜ pulsarctl git:(topic-lastmessage) ./pulsarctl topic last-message-id -h USED FOR: This command is used for getting the last message id of a topic (partition). REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Get the last message id of a topic <persistent-topic-name> pulsarctl topic last-message-id <persistent-topic-name> #Get the last message id of a partitioned topic <topic-name> pulsarctl topic last-message-id --partition-index <partition> <topic-name> OUTPUT: #normal output { "LedgerId": 0, "EntryId": 0, "PartitionedIndex": 0 } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the topic <persistent-topic-name> does not exist in the cluster [✖] code: 404 reason: Topic not found #the topic <persistent-topic-name> does not a persistent topic [✖] code: 405 reason: GetLastMessageId on a non-persistent topic is not allowed #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 last-message-id [flags] Aliases: last-message-id, lmi ``` * Add create, delete, list, policies, topic commands for namespace ctl (#57) * Add create, delete, list, police, topic commands for namespace ctl Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add backlog, retention and ttl commands for pulsarctl (#61) * Add backlog, retention and ttl commands for pulsarctl Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Revert "Add backlog, retention and ttl commands for pulsarctl (#61)" (#62) This reverts commit c844df17c3857818458e5b90d1b6afb1c5b9a560. * Add topic stats command (#46) Add command topic `stats`, `internal-stats`, `partition-stats` * topic stats * ``` ➜ pulsarctl git:(topic-stats) ✗ ./pulsarctl topic stats -h USED FOR: This command is used for getting the stats for an existing topic and its connected producers and consumers. (All the rates are computed over a 1 minute window and are relative the last completed 1 minute period) REQUIRED PERMISSION: This command requires namespace admin permissions. EXAMPLES: #Get the non-partitioned topic <topic-name> stats pulsarctl topic stats <topic-name> #Get the partitioned topic <topic-name> stats pulsarctl topic stats --partition <topic-name> #Get the partitioned topic <topic-name> stats and per partition stats pulsarctl topic stats --partition --per-partition <topic-name> OUTPUT: #Get the non-partitioned topic stats { "msgRateIn": 0, "msgRateOut": 0, "msgThroughputIn": 0, "msgThroughputOut": 0, "averageMsgSize": 0, "storageSize": 0, "publishers": [], "subscriptions": {}, "replication": {}, "deduplicationStatus": "Disabled" } #Get the partitioned topic stats { "msgRateIn": 0, "msgRateOut": 0, "msgThroughputIn": 0, "msgThroughputOut": 0, "averageMsgSize": 0, "storageSize": 0, "publishers": [], "subscriptions": {}, "replication": {}, "deduplicationStatus": "", "metadata": { "partitions": 1 }, "partitions": {} } #Get the partitioned topic stats and per partition topic stats { "msgRateIn": 0, "msgRateOut": 0, "msgThroughputIn": 0, "msgThroughputOut": 0, "averageMsgSize": 0, "storageSize": 0, "publishers": [], "subscriptions": {}, "replication": {}, "deduplicationStatus": "", "metadata": { "partitions": 1 }, "partitions": { "<topic-name>": { "msgRateIn": 0, "msgRateOut": 0, "msgThroughputIn": 0, "msgThroughputOut": 0, "averageMsgSize": 0, "storageSize": 0, "publishers": [], "subscriptions": {}, "replication": {}, "deduplicationStatus": "" } } } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic is not exist or the specified topic is a partitioned-topic and you don't specified --partition or the specified topic is a non-partitioned topic and you specified --partition 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 stats [flags] ``` * topic internal-stats * ``` ➜ pulsarctl-yong git:(topic-stats) ./pulsarctl topic internal-stats -h USED FOR: This command is used for getting the internal stats for an existing non-partitioned topic. REQUIRED PERMISSION: This command requires namespace admin permissions. EXAMPLES: #Get internal stats for an existing non-partitioned-topic <topic-name> pulsarctl topic internal-stats <topic-name> OUTPUT: #normal output { "entriesAddedCounter": 0, "numberOfEntries": 0, "totalSize": 0, "currentLedgerEntries": 0, "currentLedgerSize": 0, "lastLedgerCreatedTimestamp": "", "lastLedgerCreationFailureTimestamp": "", "waitingCursorsCount": 0, "pendingAddEntriesCount": 0, "lastConfirmedEntry": "", "state": "", "ledgers": [ { "ledgerId": 0, "entries": 0, "size": 0, "offloaded": false } ], "cursors": {} } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic is not exist or the specified topic is a partitioned topic [✖] 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 internal-stats [flags] Aliases: internal-stats, ``` * Add antiAffinityGroup, persistence, clusters, unload, spliteBundle and deduplication for pulsartl (#66) Add some commands for pulsartl, as follows: - getAntiAffinityGroup - setAntiAffinityGroup - deleteAntiAffinityGroup - getAntiAffinityNamespaces - getPersistence - setPersistence - setDeduplication - setReplicationClusters - getReplicationClusters - unload - splitBundle * Add topic permissions commands (#48) ## OUTPUT *get-permissions`* ``` ➜ pulsarctl git:(topic-permission) ./pulsarctl topic get-permissions -h USED FOR: This command is used for getting the permissions on a topic. REQUIRED PERMISSION: This command requires namespace admin permissions. EXAMPLES: #Get the permissions on a topic <topic-name> pulsarctl topic get-permissions <topic-name> OUTPUT: #normal output { "<role>": [ "<action>" ] } #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-permissions [flags] Aliases: get-permissions, get ``` *grant-permissions* ``` ➜ pulsarctl git:(topic-permission) ./pulsarctl topic grant-permissions -h USED FOR: This command is used for granting permissions to a client role on a single topic. REQUIRED PERMISSION: This command requires namespace admin permissions. EXAMPLES: #Grant permissions to a client on a single topic <topic-name> pulsarctl topic grant-permissions --role <role> --actions <action-1> --actions <action-2> <topic-name> OUTPUT: #normal output Grant role %s and actions %v to the topic %s successfully #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified role is empty Invalid role name #the specified actions is not allowed. The auth action only can be specified as 'produce', 'consume', or 'functions'. Invalid auth action '<actions>' #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 grant-permissions [flags] Aliases: grant-permissions, grant ``` *revoke-permissions* ``` ➜ pulsarctl git:(topic-permission) ./pulsarctl topic revoke-permissions -h USED FOR: This command is used for revoking permissions on a topic. REQUIRED PERMISSION: This command requires namespace admin permissions. EXAMPLES: OUTPUT: #normal output Revoke permissions for the role <role> to the topic <topic-name> successfully #the specified role is empty Invalid role name #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 revoke-permissions [flags] Aliases: revoke-permissions, revoke ``` * Add license header check for all files (#69) Fixes: #65 * Add command topic `internal-info` (#51) ### OUTPUT *internal-info* ``` ➜ pulsarctl git:(topic-info) ✗ ./pulsarctl topic internal-info -h USED FOR: This command is used for getting the internal info of a topic which has messages or subscriptions. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Get the internal info of a topic <topic-name> pulsarctl topic internal-info <topic-name> OUTPUT: #normal output { "version": 1, "creationDate": "", "modificationData": "", "ledgers": [ { "ledgerId": 0, "entries": 0, "size": 0, "timestamp": 0 } ], "terminatedPosition": { "ledgerId": 0, "entryId": 0 }, "cursors": { "hello": { "version": 0, "creationDate": "", "modificationDate": "", "cursorsLedgerId": 0, "markDelete": { "ledgerId": 0, "entryId": 0 }, "individualDeletedMessages": null, "Properties": null } } } #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic does not existing [✖] code: 500 reason: Unknown pulsar error #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 internal-info [flags] ``` * Add command unsubscribe and clearBacklog and command set and get for dispatch and subscribe and replicator rate (#68) * Add command unsubscribe and clearBacklog and command set and get for dispatch and subscirbe and replicator rate -- *Modifications* - Add command clear-backlog - Add command set-dispatch-rate - Add command get-dispatch-rate - Add command messages-encryption - Add command set-replicator-dispatch-rate - Add command get-replicator-dispatch-rate - Add command set-subscribe-rate - Add command get-subscribe-rate - Add command set-subscription-auth-mode - Add command set-subscription-dispatch-rate - Add command get-subscription-dispatch-rate - Add command unsubscribe * Add golangci-lint to check project style (#78) *Motivation* Make all project file consistent *Modifications* Format all project files * Add website for pulsarctl (#77) * Add website for pulsarctl Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com> * Add topic command `compact` and `compact-status` (#75) *Motivation* - Add command `compact` - Add command `compact-status` *compact* ``` USED FOR: This command is used for compacting a persistent topic. REQUIRED PERMISSION: This command is requires tenant admin permissions. EXAMPLES: #Compact a persistent topic <topic-name> pulsarctl topic compact <topic-name> OUTPUT: #normal output Sending compact topic <topic-name> request successfully #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic does not found [✖] 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 compact [flags] ``` *compact-status* ``` USED FOR: This command is used for getting status of compaction on a topic. REQUIRED PERMISSION: This command requires tenant admin permissions. EXAMPLES: #Get status of compaction of a persistent topic <topic-name> pulsarctl topic compact-status <topic-name> OUTPUT: #normal output Compacting the topic <topic-name> is done successfully #Compacting the topic <topic-name> is not running Compacting the topic <topic-name> is not running #Compacting the topic <topic-name> is running Compacting the topic <topic-name> is running #Compacting the topic <topic-name> is done with error Compacting the topic <topic-name> is done with error <error-msg> #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic does not found [✖] 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 compact-status [flags] ``` * Add topic command `unload` (#76) * Add topic command `unload` USED FOR: This command is used for unloading a topic. REQUIRED PERMISSION: This command requires super-user permissions. EXAMPLES: #Unload a topic <topic-name> pulsarctl topic unload <topic-name> OUTPUT: #normal output Unload topic <topic-name> successfully #the topic name is not specified [✖] only one argument is allowed to be used as a name #the specified topic does not found [✖] 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 unload [flags] * Add namespaces permissions commands (#71) --- *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 …
tisonkun
pushed a commit
to tisonkun/pulsar-client-go
that referenced
this pull request
Aug 15, 2023
Add cluster commands `get`
tisonkun
pushed a commit
to tisonkun/pulsar-client-go
that referenced
this pull request
Aug 15, 2023
chore: decouple config and auth package Signed-off-by: Max Xu <xuhuan@live.cn>
tisonkun
pushed a commit
to tisonkun/pulsar-client-go
that referenced
this pull request
Aug 15, 2023
chore: decouple config and auth package Signed-off-by: Max Xu <xuhuan@live.cn>
tisonkun
pushed a commit
to apache/pulsar-client-go
that referenced
this pull request
Aug 16, 2023
chore: decouple config and auth package Signed-off-by: Max Xu <xuhuan@live.cn>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Follow-up #3
Motivation
Respect the Single Responsibility Principle.
Actually all the auth providers are http.RoundTripper instance, they are just serving for admin resources operations.
Given that the Config is referenced by both admin and auth package, so decouple the pkg/config package to avoid cyclic import problems.
The root of pkg/admin package should focus on admin resources operations, so let's decouple non-resources operations codes.
A better package dependency graph should be:
Modifications