CloudMigrations: create snapshot for Contact Points (#94719)

* CloudMigrations: create snapshot for Contact Points

* CloudMigrations: add contact point copies and components in frontend

* CloudMigrations: temporarily use bell for all alerts resources
This commit is contained in:
Matheus Macabu
2024-10-15 16:27:28 +02:00
committed by GitHub
parent 7a2edd35d5
commit 47115c714a
9 changed files with 167 additions and 4 deletions
@@ -34,6 +34,7 @@ var currentMigrationTypes = []cloudmigration.MigrateDataType{
cloudmigration.DashboardDataType,
cloudmigration.MuteTimingType,
cloudmigration.NotificationTemplateType,
cloudmigration.ContactPointType,
}
func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.SignedInUser) (*cloudmigration.MigrateDataRequest, error) {
@@ -74,10 +75,17 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
return nil, err
}
// Alerts: Contact Points
contactPoints, err := s.getContactPoints(ctx, signedInUser)
if err != nil {
s.log.Error("Failed to get alert contact points", "err", err)
return nil, err
}
migrationDataSlice := make(
[]cloudmigration.MigrateDataRequestItem, 0,
len(dataSources)+len(dashs)+len(folders)+len(libraryElements)+
len(muteTimings)+len(notificationTemplates),
len(muteTimings)+len(notificationTemplates)+len(contactPoints),
)
for _, ds := range dataSources {
@@ -142,6 +150,15 @@ func (s *Service) getMigrationDataJSON(ctx context.Context, signedInUser *user.S
})
}
for _, contactPoint := range contactPoints {
migrationDataSlice = append(migrationDataSlice, cloudmigration.MigrateDataRequestItem{
Type: cloudmigration.ContactPointType,
RefID: contactPoint.UID,
Name: contactPoint.Name,
Data: contactPoint,
})
}
// Obtain the names of parent elements for Dashboard and Folders data types
parentNamesByType, err := s.getParentNames(ctx, signedInUser, dashs, folders, libraryElements)
if err != nil {