From 5fe0b483eb62cc9dfceb01043d2165617d974ed9 Mon Sep 17 00:00:00 2001 From: Michael Mandrus Date: Tue, 30 Apr 2024 15:10:30 -0400 Subject: [PATCH] remove migration uid from run fetch endpoint --- pkg/services/cloudmigration/api/api.go | 13 +-- public/api-merged.json | 73 ++++++++--------- .../migrate-to-cloud/api/endpoints.gen.ts | 4 +- .../features/migrate-to-cloud/onprem/Page.tsx | 2 +- public/openapi3.json | 79 ++++++++----------- 5 files changed, 72 insertions(+), 99 deletions(-) diff --git a/pkg/services/cloudmigration/api/api.go b/pkg/services/cloudmigration/api/api.go index 255e8e10a58..1a1d7ef9e29 100644 --- a/pkg/services/cloudmigration/api/api.go +++ b/pkg/services/cloudmigration/api/api.go @@ -46,7 +46,7 @@ func (cma *CloudMigrationAPI) registerEndpoints() { cloudMigrationRoute.Delete("/migration/:uid", routing.Wrap(cma.DeleteMigration)) cloudMigrationRoute.Post("/migration/:uid/run", routing.Wrap(cma.RunMigration)) cloudMigrationRoute.Get("/migration/:uid/run", routing.Wrap(cma.GetMigrationRunList)) - cloudMigrationRoute.Get("/migration/:uid/run/:runUID", routing.Wrap(cma.GetMigrationRun)) + cloudMigrationRoute.Get("/migration/run/:runUID", routing.Wrap(cma.GetMigrationRun)) cloudMigrationRoute.Post("/token", routing.Wrap(cma.CreateToken)) }, middleware.ReqOrgAdmin) } @@ -185,7 +185,7 @@ type RunCloudMigrationRequest struct { UID string `json:"uid"` } -// swagger:route GET /cloudmigration/migration/{uid}/run/{runUID} migrations getCloudMigrationRun +// swagger:route GET /cloudmigration/migration/run/{runUID} migrations getCloudMigrationRun // // Get the result of a single migration run. // @@ -195,13 +195,9 @@ type RunCloudMigrationRequest struct { // 403: forbiddenError // 500: internalServerError func (cma *CloudMigrationAPI) GetMigrationRun(c *contextmodel.ReqContext) response.Response { - // TODO Parameter 'uid' is not actually used at the moment, since we just need the run UID. - // Will be cleaned in another PR - ctx, span := cma.tracer.Start(c.Req.Context(), "MigrationAPI.GetMigrationRun") defer span.End() - // [OLD] migrationStatus, err := cma.cloudMigrationService.GetMigrationStatus(ctx, web.Params(c.Req)[":id"], web.Params(c.Req)[":runID"]) migrationStatus, err := cma.cloudMigrationService.GetMigrationStatus(ctx, web.Params(c.Req)[":runUID"]) if err != nil { return response.Error(http.StatusInternalServerError, "migration status error", err) @@ -218,11 +214,6 @@ func (cma *CloudMigrationAPI) GetMigrationRun(c *contextmodel.ReqContext) respon // swagger:parameters getCloudMigrationRun type GetMigrationRunParams struct { - // UID of a migration - // - // in: path - UID string `json:"uid"` - // RunUID of a migration run // // in: path diff --git a/public/api-merged.json b/public/api-merged.json index 2dafddb8a3e..f3f956636bc 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -2348,6 +2348,38 @@ } } }, + "/cloudmigration/migration/run/{runUID}": { + "get": { + "tags": [ + "migrations" + ], + "summary": "Get the result of a single migration run.", + "operationId": "getCloudMigrationRun", + "parameters": [ + { + "type": "string", + "description": "RunUID of a migration run", + "name": "runUID", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "$ref": "#/responses/cloudMigrationRunResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/cloudmigration/migration/{uid}": { "get": { "description": "It returns migrations that has been created.", @@ -2471,45 +2503,6 @@ } } }, - "/cloudmigration/migration/{uid}/run/{runUID}": { - "get": { - "tags": [ - "migrations" - ], - "summary": "Get the result of a single migration run.", - "operationId": "getCloudMigrationRun", - "parameters": [ - { - "type": "string", - "description": "UID of a migration", - "name": "uid", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "RunUID of a migration run", - "name": "runUID", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "$ref": "#/responses/cloudMigrationRunResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/cloudmigration/token": { "post": { "tags": [ @@ -12905,7 +12898,7 @@ } }, "Policies": { - "description": "Policies contains all policy identifiers included in the certificate.\nIn Go 1.22, encoding/gob cannot handle and ignores this field.", + "description": "Policies contains all policy identifiers included in the certificate.", "type": "array", "items": { "$ref": "#/definitions/OID" diff --git a/public/app/features/migrate-to-cloud/api/endpoints.gen.ts b/public/app/features/migrate-to-cloud/api/endpoints.gen.ts index 29d3b8c183c..bfaca70bcd4 100644 --- a/public/app/features/migrate-to-cloud/api/endpoints.gen.ts +++ b/public/app/features/migrate-to-cloud/api/endpoints.gen.ts @@ -20,7 +20,7 @@ const injectedRtkApi = api.injectEndpoints({ query: (queryArg) => ({ url: `/cloudmigration/migration/${queryArg.uid}/run`, method: 'POST' }), }), getCloudMigrationRun: build.query({ - query: (queryArg) => ({ url: `/cloudmigration/migration/${queryArg.uid}/run/${queryArg.runUid}` }), + query: (queryArg) => ({ url: `/cloudmigration/migration/run/${queryArg.runUid}` }), }), createCloudMigrationToken: build.mutation({ query: () => ({ url: `/cloudmigration/token`, method: 'POST' }), @@ -60,8 +60,6 @@ export type RunCloudMigrationApiArg = { }; export type GetCloudMigrationRunApiResponse = /** status 200 (empty) */ MigrateDataResponseDto; export type GetCloudMigrationRunApiArg = { - /** UID of a migration */ - uid: string; /** RunUID of a migration run */ runUid: string; }; diff --git a/public/app/features/migrate-to-cloud/onprem/Page.tsx b/public/app/features/migrate-to-cloud/onprem/Page.tsx index 514324cb02e..01c7b9c0d1b 100644 --- a/public/app/features/migrate-to-cloud/onprem/Page.tsx +++ b/public/app/features/migrate-to-cloud/onprem/Page.tsx @@ -46,7 +46,7 @@ function useGetLatestMigrationRun(migrationUid?: string) { const latestMigrationRun = listResult.data?.runs?.at(-1); const runResult = useGetCloudMigrationRunQuery( - latestMigrationRun?.uid && migrationUid ? { runUid: latestMigrationRun.uid, uid: migrationUid } : skipToken + latestMigrationRun?.uid && migrationUid ? { runUid: latestMigrationRun.uid } : skipToken ); return { diff --git a/public/openapi3.json b/public/openapi3.json index 50c16267a07..4486bf6a562 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -3533,7 +3533,7 @@ "type": "array" }, "Policies": { - "description": "Policies contains all policy identifiers included in the certificate.\nIn Go 1.22, encoding/gob cannot handle and ignores this field.", + "description": "Policies contains all policy identifiers included in the certificate.", "items": { "$ref": "#/components/schemas/OID" }, @@ -14986,6 +14986,40 @@ ] } }, + "/cloudmigration/migration/run/{runUID}": { + "get": { + "operationId": "getCloudMigrationRun", + "parameters": [ + { + "description": "RunUID of a migration run", + "in": "path", + "name": "runUID", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/cloudMigrationRunResponse" + }, + "401": { + "$ref": "#/components/responses/unauthorisedError" + }, + "403": { + "$ref": "#/components/responses/forbiddenError" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Get the result of a single migration run.", + "tags": [ + "migrations" + ] + } + }, "/cloudmigration/migration/{uid}": { "delete": { "operationId": "deleteCloudMigration", @@ -15117,49 +15151,6 @@ ] } }, - "/cloudmigration/migration/{uid}/run/{runUID}": { - "get": { - "operationId": "getCloudMigrationRun", - "parameters": [ - { - "description": "UID of a migration", - "in": "path", - "name": "uid", - "required": true, - "schema": { - "type": "string" - } - }, - { - "description": "RunUID of a migration run", - "in": "path", - "name": "runUID", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/cloudMigrationRunResponse" - }, - "401": { - "$ref": "#/components/responses/unauthorisedError" - }, - "403": { - "$ref": "#/components/responses/forbiddenError" - }, - "500": { - "$ref": "#/components/responses/internalServerError" - } - }, - "summary": "Get the result of a single migration run.", - "tags": [ - "migrations" - ] - } - }, "/cloudmigration/token": { "post": { "operationId": "createCloudMigrationToken",