diff --git a/pkg/pulsar/cluster.go b/pkg/pulsar/cluster.go index a98b8cf..acdae4e 100644 --- a/pkg/pulsar/cluster.go +++ b/pkg/pulsar/cluster.go @@ -11,6 +11,7 @@ type Clusters interface { UpdatePeerClusters(string, []string) error GetPeerClusters(string) ([]string, error) CreateFailureDomain(FailureDomainData) error + GetFailureDomain(clusterName, domainName string) (FailureDomainData, error) } type clusters struct { @@ -52,6 +53,7 @@ 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) GetPeerClusters(name string) ([]string, error) { var peerClusters []string endpoint := c.client.endpoint(c.basePath, name, "peers") @@ -68,3 +70,10 @@ func (c *clusters) CreateFailureDomain(data FailureDomainData) error { endpoint := c.client.endpoint(c.basePath, data.ClusterName, "failureDomains", data.DomainName) return c.client.post(endpoint, &data, nil) } + +func (c *clusters) GetFailureDomain(clusterName string, domainName string) (FailureDomainData, error) { + var res FailureDomainData + endpoint := c.client.endpoint(c.basePath, clusterName, "failureDomains", domainName) + err := c.client.get(endpoint, &res) + return res, err +} diff --git a/pkg/pulsar/data.go b/pkg/pulsar/data.go index 760c391..ede0d3a 100644 --- a/pkg/pulsar/data.go +++ b/pkg/pulsar/data.go @@ -55,5 +55,5 @@ type FunctionData struct { type FailureDomainData struct { ClusterName string `json:"-"` DomainName string `json:"-"` - BrokerList []string `json:"brokerList"` + BrokerList []string `json:"brokers"` }