From 59d06b5c56f487570867cdc8b87b2e29c04d450f Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 13 Mar 2017 12:49:19 -0400 Subject: Implement GET /cluster/status endpoint for APIv4 (#5732) --- model/client4.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'model') diff --git a/model/client4.go b/model/client4.go index 4c46d6d57..758a9e42f 100644 --- a/model/client4.go +++ b/model/client4.go @@ -154,6 +154,10 @@ func (c *Client4) GetDatabaseRoute() string { return fmt.Sprintf("/database") } +func (c *Client4) GetClusterRoute() string { + return fmt.Sprintf("/cluster") +} + func (c *Client4) GetIncomingWebhooksRoute() string { return fmt.Sprintf("/hooks/incoming") } @@ -1414,3 +1418,15 @@ func (c *Client4) DownloadComplianceReport(reportId string) ([]byte, *Response) return data, BuildResponse(rp) } } + +// Cluster Section + +// GetClusterStatus returns the status of all the configured cluster nodes. +func (c *Client4) GetClusterStatus() ([]*ClusterInfo, *Response) { + if r, err := c.DoApiGet(c.GetClusterRoute()+"/status", ""); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return ClusterInfosFromJson(r.Body), BuildResponse(r) + } +} -- cgit v1.2.3-1-g7c22