summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/mattermost/mattermost-server/v5/model/system.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-10-19 23:40:00 +0200
committerGitHub <noreply@github.com>2020-10-19 23:40:00 +0200
commit075a84427f6332aab707d283ad770d69f8816032 (patch)
tree0ff9f56a057919f3fe968e57f6f0b1c0d1f85078 /vendor/github.com/mattermost/mattermost-server/v5/model/system.go
parent950f2759bd2b20aa0bdedc3dc9a74d0dafb606d8 (diff)
downloadmatterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.gz
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.tar.bz2
matterbridge-msglm-075a84427f6332aab707d283ad770d69f8816032.zip
Update vendor (#1265)
Diffstat (limited to 'vendor/github.com/mattermost/mattermost-server/v5/model/system.go')
-rw-r--r--vendor/github.com/mattermost/mattermost-server/v5/model/system.go151
1 files changed, 142 insertions, 9 deletions
diff --git a/vendor/github.com/mattermost/mattermost-server/v5/model/system.go b/vendor/github.com/mattermost/mattermost-server/v5/model/system.go
index 4c3132e2..f826276f 100644
--- a/vendor/github.com/mattermost/mattermost-server/v5/model/system.go
+++ b/vendor/github.com/mattermost/mattermost-server/v5/model/system.go
@@ -10,15 +10,37 @@ import (
)
const (
- SYSTEM_DIAGNOSTIC_ID = "DiagnosticId"
- SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
- SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
- SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
- SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
- SYSTEM_ASYMMETRIC_SIGNING_KEY = "AsymmetricSigningKey"
- SYSTEM_POST_ACTION_COOKIE_SECRET = "PostActionCookieSecret"
- SYSTEM_INSTALLATION_DATE_KEY = "InstallationDate"
- SYSTEM_FIRST_SERVER_RUN_TIMESTAMP_KEY = "FirstServerRunTimestamp"
+ SYSTEM_TELEMETRY_ID = "DiagnosticId"
+ SYSTEM_RAN_UNIT_TESTS = "RanUnitTests"
+ SYSTEM_LAST_SECURITY_TIME = "LastSecurityTime"
+ SYSTEM_ACTIVE_LICENSE_ID = "ActiveLicenseId"
+ SYSTEM_LAST_COMPLIANCE_TIME = "LastComplianceTime"
+ SYSTEM_ASYMMETRIC_SIGNING_KEY = "AsymmetricSigningKey"
+ SYSTEM_POST_ACTION_COOKIE_SECRET = "PostActionCookieSecret"
+ SYSTEM_INSTALLATION_DATE_KEY = "InstallationDate"
+ SYSTEM_FIRST_SERVER_RUN_TIMESTAMP_KEY = "FirstServerRunTimestamp"
+ SYSTEM_CLUSTER_ENCRYPTION_KEY = "ClusterEncryptionKey"
+ SYSTEM_UPGRADED_FROM_TE_ID = "UpgradedFromTE"
+ SYSTEM_WARN_METRIC_NUMBER_OF_TEAMS_5 = "warn_metric_number_of_teams_5"
+ SYSTEM_WARN_METRIC_NUMBER_OF_CHANNELS_50 = "warn_metric_number_of_channels_50"
+ SYSTEM_WARN_METRIC_MFA = "warn_metric_mfa"
+ SYSTEM_WARN_METRIC_EMAIL_DOMAIN = "warn_metric_email_domain"
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_100 = "warn_metric_number_of_active_users_100"
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_200 = "warn_metric_number_of_active_users_200"
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_300 = "warn_metric_number_of_active_users_300"
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_500 = "warn_metric_number_of_active_users_500"
+ SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_2M = "warn_metric_number_of_posts_2M"
+ SYSTEM_WARN_METRIC_LAST_RUN_TIMESTAMP_KEY = "LastWarnMetricRunTimestamp"
+)
+
+const (
+ WARN_METRIC_STATUS_LIMIT_REACHED = "true"
+ WARN_METRIC_STATUS_RUNONCE = "runonce"
+ WARN_METRIC_STATUS_ACK = "ack"
+ WARN_METRIC_STATUS_STORE_PREFIX = "warn_metric_"
+ WARN_METRIC_JOB_INTERVAL = 24 * 7
+ WARN_METRIC_NUMBER_OF_ACTIVE_USERS_25 = 25
+ WARN_METRIC_JOB_WAIT_TIME = 1000 * 3600 * 24 * 7 // 7 days
)
type System struct {
@@ -69,3 +91,114 @@ func ServerBusyStateFromJson(r io.Reader) *ServerBusyState {
json.NewDecoder(r).Decode(&sbs)
return sbs
}
+
+var WarnMetricsTable = map[string]WarnMetric{
+ SYSTEM_WARN_METRIC_MFA: {
+ Id: SYSTEM_WARN_METRIC_MFA,
+ Limit: -1,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_EMAIL_DOMAIN: {
+ Id: SYSTEM_WARN_METRIC_EMAIL_DOMAIN,
+ Limit: -1,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_TEAMS_5: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_TEAMS_5,
+ Limit: 5,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_CHANNELS_50: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_CHANNELS_50,
+ Limit: 50,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_100: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_100,
+ Limit: 100,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_200: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_200,
+ Limit: 200,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_300: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_300,
+ Limit: 300,
+ IsBotOnly: true,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_500: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_ACTIVE_USERS_500,
+ Limit: 500,
+ IsBotOnly: false,
+ IsRunOnce: true,
+ },
+ SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_2M: {
+ Id: SYSTEM_WARN_METRIC_NUMBER_OF_POSTS_2M,
+ Limit: 2000000,
+ IsBotOnly: false,
+ IsRunOnce: true,
+ },
+}
+
+type WarnMetric struct {
+ Id string
+ Limit int64
+ IsBotOnly bool
+ IsRunOnce bool
+}
+
+type WarnMetricDisplayTexts struct {
+ BotTitle string
+ BotMessageBody string
+ BotSuccessMessage string
+ EmailBody string
+}
+type WarnMetricStatus struct {
+ Id string `json:"id"`
+ Limit int64 `json:"limit"`
+ Acked bool `json:"acked"`
+ StoreStatus string `json:"store_status,omitempty"`
+}
+
+func (wms *WarnMetricStatus) ToJson() string {
+ b, _ := json.Marshal(wms)
+ return string(b)
+}
+
+func WarnMetricStatusFromJson(data io.Reader) *WarnMetricStatus {
+ var o WarnMetricStatus
+ if err := json.NewDecoder(data).Decode(&o); err != nil {
+ return nil
+ } else {
+ return &o
+ }
+}
+
+func MapWarnMetricStatusToJson(o map[string]*WarnMetricStatus) string {
+ b, _ := json.Marshal(o)
+ return string(b)
+}
+
+type SendWarnMetricAck struct {
+ ForceAck bool `json:"forceAck"`
+}
+
+func (swma *SendWarnMetricAck) ToJson() string {
+ b, _ := json.Marshal(swma)
+ return string(b)
+}
+
+func SendWarnMetricAckFromJson(r io.Reader) *SendWarnMetricAck {
+ var swma *SendWarnMetricAck
+ json.NewDecoder(r).Decode(&swma)
+ return swma
+}