Skip to content

Commit

Permalink
Add command cluster update-peer-clusters (streamnative/pulsar-admin…
Browse files Browse the repository at this point in the history
…-go#18)

Master issue: streamnative/pulsar-admin-go#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.
```
  • Loading branch information
zymap authored and tisonkun committed Aug 15, 2023
1 parent 5fce4b5 commit eb559a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pulsaradmin/pkg/pulsar/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type Clusters interface {
Create(ClusterData) error
Delete(string) error
Update(ClusterData) error
UpdatePeerClusters(string, []string) error
}

type clusters struct {
Expand Down Expand Up @@ -50,3 +51,8 @@ func (c *clusters) Update(cdata ClusterData) error {
endpoint := c.client.endpoint(c.basePath, cdata.Name)
return c.client.post(endpoint, &cdata, nil)
}

func (c *clusters) UpdatePeerClusters(cluster string, peerClusters []string) error {
endpoint := c.client.endpoint(c.basePath, cluster, "peers")
return c.client.post(endpoint, peerClusters, nil)
}

0 comments on commit eb559a1

Please sign in to comment.