CloudMigrations: Create resource dependency map to validate snapshot request (#102594)

* CloudMigrations: Create resource dependency map to validate snapshot request

* CloudMigrations: Validate resource types dependencies in create snapshot request

* CloudMigrations: Update service interface to pass parsed resource types for creation

* CloudMigrations: Conditionally append resource to snapshot if enabled

* CloudMigrations: Add /cloudmigration/resources/dependencies endpoint

* CloudMigrations: Properly filter dashboards and folders from snapshot
This commit is contained in:
Matheus Macabu
2025-04-08 17:46:25 +02:00
committed by GitHub
parent 662b635ef9
commit 3fad6183aa
18 changed files with 1064 additions and 184 deletions
+13
View File
@@ -14,6 +14,7 @@ var (
ErrMigrationNotDeleted = errutil.Internal("cloudmigrations.sessionNotDeleted").Errorf("Session not deleted")
ErrTokenNotFound = errutil.NotFound("cloudmigrations.tokenNotFound").Errorf("Token not found")
ErrSnapshotNotFound = errutil.NotFound("cloudmigrations.snapshotNotFound").Errorf("Snapshot not found")
ErrEmptyResourceTypes = errutil.BadRequest("cloudmigrations.emptyResourceTypes").Errorf("Resource types cannot be empty")
)
// CloudMigration domain structs
@@ -192,6 +193,18 @@ type SnapshotResultQueryParams struct {
ErrorsOnly bool
}
type ResourceTypes map[MigrateDataType]struct{}
func (r ResourceTypes) Has(t MigrateDataType) bool {
_, ok := r[t]
return ok
}
type CreateSnapshotCommand struct {
SessionUID string
ResourceTypes ResourceTypes
}
type GetSnapshotsQuery struct {
SnapshotUID string
OrgID int64