2016-07-27 12:09:55 +02:00
|
|
|
package notifiers
|
|
|
|
|
|
2016-09-06 13:19:05 +02:00
|
|
|
import (
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
2016-09-13 15:09:55 +02:00
|
|
|
"github.com/grafana/grafana/pkg/services/alerting"
|
2016-09-06 13:19:05 +02:00
|
|
|
)
|
|
|
|
|
|
2016-07-27 12:09:55 +02:00
|
|
|
type NotifierBase struct {
|
2016-10-11 10:13:19 +02:00
|
|
|
Name string
|
|
|
|
|
Type string
|
|
|
|
|
Id int64
|
|
|
|
|
IsDeault bool
|
2016-09-06 13:19:05 +02:00
|
|
|
}
|
|
|
|
|
|
2016-10-11 10:13:19 +02:00
|
|
|
func NewNotifierBase(id int64, isDefault bool, name, notifierType string, model *simplejson.Json) NotifierBase {
|
|
|
|
|
return NotifierBase{
|
|
|
|
|
Id: id,
|
|
|
|
|
Name: name,
|
|
|
|
|
IsDeault: isDefault,
|
|
|
|
|
Type: notifierType,
|
|
|
|
|
}
|
2016-09-06 13:19:05 +02:00
|
|
|
}
|
|
|
|
|
|
2016-09-13 15:09:55 +02:00
|
|
|
func (n *NotifierBase) PassesFilter(rule *alerting.Rule) bool {
|
|
|
|
|
return true
|
2016-07-27 12:09:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (n *NotifierBase) GetType() string {
|
|
|
|
|
return n.Type
|
|
|
|
|
}
|
2016-07-29 14:55:02 +02:00
|
|
|
|
|
|
|
|
func (n *NotifierBase) NeedsImage() bool {
|
|
|
|
|
return true
|
|
|
|
|
}
|
2016-10-11 10:13:19 +02:00
|
|
|
|
|
|
|
|
func (n *NotifierBase) GetNotifierId() int64 {
|
|
|
|
|
return n.Id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (n *NotifierBase) GetIsDefault() bool {
|
|
|
|
|
return n.IsDeault
|
|
|
|
|
}
|