Skip to content

Commit

Permalink
Add command cluster get-peer-clusters (streamnative/pulsarctl#19)
Browse files Browse the repository at this point in the history
* Add command cluster `get-peer-clusters`
---

Master Issue: streamnative/pulsarctl#2

* Fix long description
  • Loading branch information
zymap authored and tisonkun committed Aug 16, 2023
1 parent 30be14b commit 61615ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pulsaradmin/pkg/pulsar/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type Clusters interface {
Delete(string) error
Update(ClusterData) error
UpdatePeerClusters(string, []string) error
GetPeerClusters(string) ([]string, error)
}

type clusters struct {
Expand Down Expand Up @@ -53,6 +54,12 @@ func (c *clusters) Update(cdata ClusterData) error {
}

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

0 comments on commit 61615ea

Please sign in to comment.