CloudMigrations: Implement snapshot management apis (#89296)

* add new apis

* add payloads

* create snapshot status type

* add some impl

* finish implementing update

* start implementing build snapshot func

* add more fake build logic

* add cancel endpoint. do some cleanup

* implement GetSnapshot

* implement upload snapshot

* merge onprem status with gms result

* get it working

* update comment

* rename list endpoint

* add query limit and offset

* add helper method to snapshot

* little bit of cleanup

* work on swagger annotations

* manual merge

* generate swagger specs

* clean up curl commands

* fix bugs found during final testing

* fix linter issue

* fix unit test
This commit is contained in:
Michael Mandrus
2024-06-19 09:20:52 -04:00
committed by GitHub
parent d928fac5c3
commit 8a8f97b0e4
20 changed files with 1939 additions and 182 deletions
@@ -5,7 +5,7 @@ import (
)
func addCloudMigrationsMigrations(mg *Migrator) {
// v1 - synchronous workflow
// --- v1 - synchronous workflow
migrationTable := Table{
Name: "cloud_migration",
Columns: []*Column{
@@ -65,7 +65,7 @@ func addCloudMigrationsMigrations(mg *Migrator) {
Cols: []string{"uid"}, Type: UniqueIndex,
}))
// v2 - asynchronous workflow refactor
// --- v2 - asynchronous workflow refactor
sessionTable := Table{
Name: "cloud_migration_session",
Columns: []*Column{
@@ -120,4 +120,23 @@ func addCloudMigrationsMigrations(mg *Migrator) {
"updated": "updated",
"finished": "finished",
})
// --- add new columns to snapshots table
uploadUrlColumn := Column{Name: "upload_url", Type: DB_Text, Nullable: true}
mg.AddMigration("add snapshot upload_url column", NewAddColumnMigration(migrationSnapshotTable, &uploadUrlColumn))
statusColumn := Column{Name: "status", Type: DB_Text, Nullable: false}
mg.AddMigration("add snapshot status column", NewAddColumnMigration(migrationSnapshotTable, &statusColumn))
localDirColumn := Column{Name: "local_directory", Type: DB_Text, Nullable: true}
mg.AddMigration("add snapshot local_directory column", NewAddColumnMigration(migrationSnapshotTable, &localDirColumn))
gmsSnapshotUIDColumn := Column{Name: "gms_snapshot_uid", Type: DB_Text, Nullable: true}
mg.AddMigration("add snapshot gms_snapshot_uid column", NewAddColumnMigration(migrationSnapshotTable, &gmsSnapshotUIDColumn))
encryptionKeyColumn := Column{Name: "encryption_key", Type: DB_Text, Nullable: true}
mg.AddMigration("add snapshot encryption_key column", NewAddColumnMigration(migrationSnapshotTable, &encryptionKeyColumn))
errorStringColumn := Column{Name: "error_string", Type: DB_Text, Nullable: true}
mg.AddMigration("add snapshot error_string column", NewAddColumnMigration(migrationSnapshotTable, &errorStringColumn))
}