github.com/larkox/mattermost-server@v5.11.1+incompatible/model/plugin_status.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package model 5 6 import ( 7 "encoding/json" 8 "io" 9 ) 10 11 const ( 12 PluginStateNotRunning = 0 13 PluginStateStarting = 1 // unused by server 14 PluginStateRunning = 2 15 PluginStateFailedToStart = 3 16 PluginStateFailedToStayRunning = 4 // unused by server 17 PluginStateStopping = 5 // unused by server 18 ) 19 20 // PluginStatus provides a cluster-aware view of installed plugins. 21 type PluginStatus struct { 22 PluginId string `json:"plugin_id"` 23 ClusterId string `json:"cluster_id"` 24 PluginPath string `json:"plugin_path"` 25 State int `json:"state"` 26 Name string `json:"name"` 27 Description string `json:"description"` 28 Version string `json:"version"` 29 } 30 31 type PluginStatuses []*PluginStatus 32 33 func (m *PluginStatuses) ToJson() string { 34 b, _ := json.Marshal(m) 35 return string(b) 36 } 37 38 func PluginStatusesFromJson(data io.Reader) PluginStatuses { 39 var m PluginStatuses 40 json.NewDecoder(data).Decode(&m) 41 return m 42 }