base.go 786 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package notifiers
  2. import (
  3. "github.com/grafana/grafana/pkg/components/simplejson"
  4. "github.com/grafana/grafana/pkg/services/alerting"
  5. )
  6. type NotifierBase struct {
  7. Name string
  8. Type string
  9. Id int64
  10. IsDeault bool
  11. }
  12. func NewNotifierBase(id int64, isDefault bool, name, notifierType string, model *simplejson.Json) NotifierBase {
  13. return NotifierBase{
  14. Id: id,
  15. Name: name,
  16. IsDeault: isDefault,
  17. Type: notifierType,
  18. }
  19. }
  20. func (n *NotifierBase) PassesFilter(rule *alerting.Rule) bool {
  21. return true
  22. }
  23. func (n *NotifierBase) GetType() string {
  24. return n.Type
  25. }
  26. func (n *NotifierBase) NeedsImage() bool {
  27. return true
  28. }
  29. func (n *NotifierBase) GetNotifierId() int64 {
  30. return n.Id
  31. }
  32. func (n *NotifierBase) GetIsDefault() bool {
  33. return n.IsDeault
  34. }