CloudMigrations: save snapshot of alert rule groups (#100109)
This commit is contained in:
@@ -43,6 +43,7 @@ var currentMigrationTypes = []cloudmigration.MigrateDataType{
|
||||
cloudmigration.NotificationTemplateType,
|
||||
cloudmigration.ContactPointType,
|
||||
cloudmigration.NotificationPolicyType,
|
||||
cloudmigration.AlertRuleGroupType,
|
||||
cloudmigration.AlertRuleType,
|
||||
cloudmigration.PluginDataType,
|
||||
}
|
||||
@@ -106,6 +107,13 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Alerts: Alert Rule Groups
|
||||
alertRuleGroups, err := s.getAlertRuleGroups(ctx, signedInUser)
|
||||
if err != nil {
|
||||
s.log.Error("Failed to get alert rule groups", "err", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Alerts: Alert Rules
|
||||
alertRules, err := s.getAlertRules(ctx, signedInUser)
|
||||
if err != nil {
|
||||
@@ -209,6 +217,15 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
|
||||
})
|
||||
}
|
||||
|
||||
for _, alertRuleGroup := range alertRuleGroups {
|
||||
migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{
|
||||
Type: cloudmigration.AlertRuleGroupType,
|
||||
RefID: alertRuleGroup.Title, // no UID available
|
||||
Name: alertRuleGroup.Title,
|
||||
Data: alertRuleGroup,
|
||||
})
|
||||
}
|
||||
|
||||
for _, alertRule := range alertRules {
|
||||
migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{
|
||||
Type: cloudmigration.AlertRuleType,
|
||||
|
||||
Reference in New Issue
Block a user