Alerting: Support for simplified notification settings in rule API (#81011)
* Add notification settings to storage\domain and API models. Settings are a slice to workaround XORM mapping * Support validation of notification settings when rules are updated * Implement route generator for Alertmanager configuration. That fetches all notification settings. * Update multi-tenant Alertmanager to run the generator before applying the configuration. * Add notification settings labels to state calculation * update the Multi-tenant Alertmanager to provide validation for notification settings * update GET API so only admins can see auto-gen
This commit is contained in:
@@ -117,6 +117,8 @@ func (oss *OSSMigrations) AddMigration(mg *Migrator) {
|
||||
}
|
||||
|
||||
addKVStoreMySQLValueTypeLongTextMigration(mg)
|
||||
|
||||
ualert.AddRuleNotificationSettingsColumns(mg)
|
||||
}
|
||||
|
||||
func addStarMigrations(mg *Migrator) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package ualert
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
)
|
||||
|
||||
// AddRuleNotificationSettingsColumns creates a column for notification settings in the alert_rule and alert_rule_version tables.
|
||||
func AddRuleNotificationSettingsColumns(mg *migrator.Migrator) {
|
||||
mg.AddMigration("add notification_settings column to alert_rule table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_rule"}, &migrator.Column{
|
||||
Name: "notification_settings",
|
||||
Type: migrator.DB_Text,
|
||||
Nullable: true,
|
||||
}))
|
||||
|
||||
mg.AddMigration("add notification_settings column to alert_rule_version table", migrator.NewAddColumnMigration(migrator.Table{Name: "alert_rule_version"}, &migrator.Column{
|
||||
Name: "notification_settings",
|
||||
Type: migrator.DB_Text,
|
||||
Nullable: true,
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user