Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt pulsar-admin-go sources #1079

Merged
merged 188 commits into from
Aug 16, 2023
Merged

Conversation

tisonkun
Copy link
Member

@tisonkun tisonkun commented Aug 15, 2023

This refers to #1075.

We should use rebase and merge to keep the commit history.

cc @flowchartsman @maxsxu

For sharing, the merging steps are:

# 1. clone pulsar-admin-go
# 2. Prefix all the commit paths with "pulsaradmin"
$ (pulsar-admin-go) git filter-branch --tree-filter 'mkdir -p pulsaradmin && ls -A | grep -v pulsaradmin | xargs -I files mv files pulsaradmin/' -- HEAD
# 3. Modify GitHub refs
$ (pulsar-admin-go) git filter-branch -f --msg-filter 'perl -pe "s/#(\d+)/streamnative\/pulsar-admin-go#\$1/"' -- HEAD
# 3.5 Because the original refs contains unfixed refs to pulsarctl, I bisect the commit and update the refs for pulsarctl also
$ (pulsar-admin-go) git checkout -b backup
$ (pulsar-admin-go) git checkout -
$ (pulsar-admin-go) git reset --hard ffbd10cedac815130806188900ac1f25d5106555
$ (pulsar-admin-go) git filter-branch -f --msg-filter 'perl -pe "s/streamnative\/pulsar-admin-go#\$1/streamnative\/pulsarctl#\$1/"'  -- 79db72a..HEAD
$ (pulsar-admin-go) git cherry-pick 8810349d20436d30fe548e9ffba135735196fc09..backup 
# 4. Add admin sources from within pulsar-client-go
#   supposed the layout is as below after step 2:
#    - pulsar-admin-go/pulsaradmin
#    - pulsar-client-go/
$ (pulsar-client-go) git subtree add --prefix=pulsaradmin ../pulsar-admin-go <pulsar-admin-go-branch-name> 

streamnativebot and others added 30 commits August 16, 2023 00:03
* Initialize the pulsarctl project

*Modifications*

- setup the project layout
- add two clusters command
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>

Add post request for project
*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.
Master issue: streamnative/pulsarctl#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.
```
Master issue: streamnative/pulsarctl#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`
---

Master Issue: streamnative/pulsarctl#2

* Fix long description
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Master issue: streamnative/pulsarctl#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.
```
Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>

Master Issue: streamnative/pulsarctl#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
```
Master issue: streamnative/pulsarctl#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.
```
Master Issue: streamnative/pulsarctl#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)
```
Master issue: streamnative/pulsarctl#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.
```
…arctl#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, 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
```
Master issue: streamnative/pulsarctl#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.
```
Master issue: streamnative/pulsarctl#2 

The pull requests add all tenant commands.
…tions (streamnative/pulsarctl#34)

Master Issue: streamnative/pulsarctl#2 

Add `stats`, `status`, `querystate`, `putstate`, `trigger` cmds for Pulsar Functions
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
```
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

Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
)

## 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 foor pulsarctl

Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>
Add sink commands for pulsarctl

- createSinksCmd
- updateSinksCmd
- deleteSinksCmd
- getSinksCmd
- listSinksCmd
- stopSinksCmd
- startSinksCmd
- restartSinksCmd
- statusSinksCmd
maxsxu and others added 19 commits August 16, 2023 00:30
…in-go#15)

Added a default auth provider.

Signed-off-by: Max Xu <xuhuan@live.cn>
pulsar-admin-go is a library not an application.

Signed-off-by: Max Xu <xuhuan@live.cn>
* docs: complete code demo

* docs: fix code style

* docs: make the code demo simple
…min-go#18)

ci: add PR title checker

Signed-off-by: Max Xu <xuhuan@live.cn>
…min-go#23)

* feat: add new parameters BrokerClientTrustCertsFilePath and BrokerClientTlsEnabled for cluster

* fix: var naming
fix: keyring file dir

Signed-off-by: Max Xu <xuhuan@live.cn>
…streamnative/pulsar-admin-go#29)

* Align function/sink/source config with latest pulsar(@2b01f83e)

* Add yaml tags

* Fix lint
add GetMessageID api

Co-authored-by: 辛传涛 <xinchuantao@bilibili.com>
Co-authored-by: Fushu Wang <fswang@streamnative.io>
… is nil (streamnative/pulsar-admin-go#36)

Use pointer for struct field so the default value from unmarshal is nil

Co-authored-by: Neng Lu <nlu@streamnative.io>
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
tisonkun added a commit that referenced this pull request Aug 15, 2023
For #1079.

We can toggle the config once that PR gets merged.
merlimat pushed a commit that referenced this pull request Aug 15, 2023
For #1079.

We can toggle the config once that PR gets merged.
@tisonkun
Copy link
Member Author

Merging...

@flowchartsman you can start the refactor and ping me on issues or PRs if your need any help :D

@tisonkun tisonkun merged commit 71afeb2 into apache:master Aug 16, 2023
6 checks passed
@tisonkun tisonkun deleted the merge-to-client-go branch August 16, 2023 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.