summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-13 12:49:19 -0400
committerGitHub <noreply@github.com>2017-03-13 12:49:19 -0400
commit59d06b5c56f487570867cdc8b87b2e29c04d450f (patch)
treebbefc2d11719fe778e9c07cb3bffd159a806373b /model
parent27d2c1f6febdc6b80f60837086ebe0c08f975147 (diff)
downloadchat-59d06b5c56f487570867cdc8b87b2e29c04d450f.tar.gz
chat-59d06b5c56f487570867cdc8b87b2e29c04d450f.tar.bz2
chat-59d06b5c56f487570867cdc8b87b2e29c04d450f.zip
Implement GET /cluster/status endpoint for APIv4 (#5732)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go16
1 files changed, 16 insertions, 0 deletions
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)
+ }
+}