CloudMigrations: Store encryption key in unified secrets table (#90908)

* store encryption key in unified secrets table

* fix local dev mode

* make metadata more realistic

* fix tests

* fix sql queries against postgres

* fix stats endpoint
This commit is contained in:
Michael Mandrus
2024-07-25 06:34:25 +03:00
committed by GitHub
parent 49c756d774
commit dc355331a6
11 changed files with 60 additions and 35 deletions
+1
View File
@@ -445,6 +445,7 @@ func (cma *CloudMigrationAPI) GetSnapshot(c *contextmodel.ReqContext) response.R
dtoStats := SnapshotResourceStats{
Types: make(map[MigrateDataType]int, len(snapshot.StatsRollup.CountsByStatus)),
Statuses: make(map[ItemStatus]int, len(snapshot.StatsRollup.CountsByType)),
Total: snapshot.StatsRollup.Total,
}
for s, c := range snapshot.StatsRollup.CountsByStatus {
dtoStats.Statuses[ItemStatus(s)] = c
+1 -1
View File
@@ -471,7 +471,7 @@ func TestCloudMigrationAPI_GetSnapshot(t *testing.T) {
requestUrl: "/api/cloudmigration/migration/1234/snapshot/1",
basicRole: org.RoleAdmin,
expectedHttpResult: http.StatusOK,
expectedBody: `{"uid":"fake_uid","status":"CREATING","sessionUid":"1234","created":"0001-01-01T00:00:00Z","finished":"0001-01-01T00:00:00Z","results":[],"stats":{"types":{},"statuses":{}}}`,
expectedBody: `{"uid":"fake_uid","status":"CREATING","sessionUid":"1234","created":"0001-01-01T00:00:00Z","finished":"0001-01-01T00:00:00Z","results":[],"stats":{"types":{},"statuses":{},"total":0}}`,
},
{
desc: "should return 403 if no used is not admin",
+1
View File
@@ -307,6 +307,7 @@ type GetSnapshotResponseDTO struct {
type SnapshotResourceStats struct {
Types map[MigrateDataType]int `json:"types"`
Statuses map[ItemStatus]int `json:"statuses"`
Total int `json:"total"`
}
// swagger:parameters getShapshotList