remove migration uid from run fetch endpoint

This commit is contained in:
Michael Mandrus 2024-04-30 15:10:30 -04:00
parent 949121ac7f
commit 5fe0b483eb
5 changed files with 72 additions and 99 deletions

View File

@ -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

View File

@ -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"

View File

@ -20,7 +20,7 @@ const injectedRtkApi = api.injectEndpoints({
query: (queryArg) => ({ url: `/cloudmigration/migration/${queryArg.uid}/run`, method: 'POST' }),
}),
getCloudMigrationRun: build.query<GetCloudMigrationRunApiResponse, GetCloudMigrationRunApiArg>({
query: (queryArg) => ({ url: `/cloudmigration/migration/${queryArg.uid}/run/${queryArg.runUid}` }),
query: (queryArg) => ({ url: `/cloudmigration/migration/run/${queryArg.runUid}` }),
}),
createCloudMigrationToken: build.mutation<CreateCloudMigrationTokenApiResponse, CreateCloudMigrationTokenApiArg>({
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;
};

View File

@ -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 {

View File

@ -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",