forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
38 lines (33 loc) · 1.58 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package notifiers
import "github.com/grafana/grafana/pkg/components/simplejson"
type notificationsAsConfig struct {
Notifications []*notificationFromConfig `json:"notifiers" yaml:"notifiers"`
DeleteNotifications []*deleteNotificationConfig `json:"delete_notifiers" yaml:"delete_notifiers"`
}
type deleteNotificationConfig struct {
Uid string `json:"uid" yaml:"uid"`
Name string `json:"name" yaml:"name"`
OrgId int64 `json:"org_id" yaml:"org_id"`
OrgName string `json:"org_name" yaml:"org_name"`
}
type notificationFromConfig struct {
Uid string `json:"uid" yaml:"uid"`
OrgId int64 `json:"org_id" yaml:"org_id"`
OrgName string `json:"org_name" yaml:"org_name"`
Name string `json:"name" yaml:"name"`
Type string `json:"type" yaml:"type"`
SendReminder bool `json:"send_reminder" yaml:"send_reminder"`
DisableResolveMessage bool `json:"disable_resolve_message" yaml:"disable_resolve_message"`
Frequency string `json:"frequency" yaml:"frequency"`
IsDefault bool `json:"is_default" yaml:"is_default"`
Settings map[string]interface{} `json:"settings" yaml:"settings"`
}
func (notification notificationFromConfig) SettingsToJson() *simplejson.Json {
settings := simplejson.New()
if len(notification.Settings) > 0 {
for k, v := range notification.Settings {
settings.Set(k, v)
}
}
return settings
}