github.com/turgay/mattermost-server@v5.3.2-0.20181002173352-2945e8a2b0ce+incompatible/api4/cluster.go (about) 1 // Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package api4 5 6 import ( 7 "net/http" 8 9 "github.com/mattermost/mattermost-server/model" 10 ) 11 12 func (api *API) InitCluster() { 13 api.BaseRoutes.Cluster.Handle("/status", api.ApiSessionRequired(getClusterStatus)).Methods("GET") 14 } 15 16 func getClusterStatus(c *Context, w http.ResponseWriter, r *http.Request) { 17 if !c.App.SessionHasPermissionTo(c.Session, model.PERMISSION_MANAGE_SYSTEM) { 18 c.SetPermissionError(model.PERMISSION_MANAGE_SYSTEM) 19 return 20 } 21 22 infos := c.App.GetClusterStatus() 23 w.Write([]byte(model.ClusterInfosToJson(infos))) 24 }