2024-02-07 11:55:48 -06:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/grafana/grafana/pkg/util/errutil"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
errAlertRuleConflictMsg = "conflicting alert rule found [rule_uid: '{{ .Public.RuleUID }}', title: '{{ .Public.Title }}', namespace_uid: '{{ .Public.NamespaceUID }}']: {{ .Public.Error }}"
|
|
|
|
ErrAlertRuleConflictBase = errutil.Conflict("alerting.alert-rule.conflict").
|
|
|
|
MustTemplate(errAlertRuleConflictMsg, errutil.WithPublic(errAlertRuleConflictMsg))
|
2024-03-12 14:38:21 -05:00
|
|
|
ErrAlertRuleGroupNotFound = errutil.NotFound("alerting.alert-rule.notFound")
|
2024-02-07 11:55:48 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
func ErrAlertRuleConflict(rule AlertRule, underlying error) error {
|
|
|
|
return ErrAlertRuleConflictBase.Build(errutil.TemplateData{Public: map[string]any{"RuleUID": rule.UID, "Title": rule.Title, "NamespaceUID": rule.NamespaceUID, "Error": underlying.Error()}, Error: underlying})
|
|
|
|
}
|