Implement GET /cluster/status endpoint for APIv4 (#5732)

Этот коммит содержится в:
Joram Wilander
2017-03-13 12:49:19 -04:00
коммит произвёл GitHub
родитель 27d2c1f6fe
Коммит 59d06b5c56
5 изменённых файлов: 77 добавлений и 6 удалений

Просмотреть файл

@@ -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)
}
}