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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user