From 637605c07dabaefda3b1b23dda48ef0682eb1ad3 Mon Sep 17 00:00:00 2001 From: Mohit Agarwal Date: Mon, 27 Feb 2023 14:24:41 +0530 Subject: [PATCH] Follow-up Swagger API changes required for progress-reporting related changes in DatabaseOperations (#22775) * Add Swagger API changes required for progress-reporting related changes in DatabaseOperations * Follow up changes required for progress-reporting related changes in DatabaseOperations * updated example file * Added Failed case in list-operations examples --- .../DatabaseOperations.json | 31 +++++++++++----- .../examples/ListDatabaseOperations.json | 36 ++++++++++++++----- 2 files changed, 50 insertions(+), 17 deletions(-) diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/DatabaseOperations.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/DatabaseOperations.json index 2bc61fd40147..229df22f6870 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/DatabaseOperations.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/DatabaseOperations.json @@ -236,16 +236,31 @@ "type": "boolean", "readOnly": true }, - "phaseCode": { - "format": "int32", - "description": "The operation phase code.", - "type": "integer", + "operationPhaseDetails": { + "$ref": "#/definitions/PhaseDetails", + "description": "The operation phase details.", "readOnly": true - }, - "phaseDescription": { - "description": "The operation phase description.", + } + } + }, + "PhaseDetails": { + "description": "The phase details properties of a database operation.", + "type": "object", + "properties": { + "phase": { + "description": "The operation phase.", + "enum": [ + "Copying", + "Catchup", + "WaitingForCutover", + "CutoverInProgress" + ], "type": "string", - "readOnly": true + "readOnly": true, + "x-ms-enum": { + "name": "Phase", + "modelAsString": true + } }, "phaseInformation": { "description": "The operation phase information.", diff --git a/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/ListDatabaseOperations.json b/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/ListDatabaseOperations.json index a77b28fe7edc..37713bd29ff7 100644 --- a/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/ListDatabaseOperations.json +++ b/specification/sql/resource-manager/Microsoft.Sql/preview/2022-11-01-preview/examples/ListDatabaseOperations.json @@ -22,10 +22,6 @@ "serverName": "testsvr", "startTime": "2023-02-13T06:25:23.67Z", "state": "Succeeded", - "errorCode": 40640, - "errorDescription": "The server encountered an unexpected exception.", - "errorSeverity": 20, - "isUserError": true, "estimatedCompletionTime": "2023-02-17T14:30:30.71Z", "description": "'UpdateLogicalDatabase' on database 'testdb', Source ServiceLevelObjective 'SQLDB_GP_Gen5_2', target ServiceLevelObjective 'SQLDB_HS_Gen5_2', target database MaxSize '32'GB", "isCancellable": true @@ -46,13 +42,35 @@ "estimatedCompletionTime": "2023-02-17T14:30:30.71Z", "description": "'UpdateLogicalDatabase' on database 'testdb', Source ServiceLevelObjective 'SQLDB_GP_Gen5_2', target ServiceLevelObjective 'SQLDB_HS_Gen5_2', target database MaxSize '32'GB", "isCancellable": true, - "phaseCode": 3, - "phaseDescription": "WaitingForCutover (3 of 4)", - "phaseInformation": { - "performCutoverBy": "2/17/2023 11:57:06 AM", - "dataDelayInMb": "31" + "operationPhaseDetails": { + "phase": "WaitingForCutover", + "phaseInformation": { + "currentStep": "3", + "totalSteps": "4", + "performCutoverBy": "2/17/2023 11:57:06 AM", + "dataDelayInMb": "31" + } } } + }, + { + "id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Default-SQL-SouthEastAsia/providers/Microsoft.Sql/servers/testsvr/databases/testdb/operations/55555555-5555-5555-5555-555555555555", + "name": "55555555-5555-5555-5555-555555555555", + "type": "Microsoft.Sql/servers/databases/operations", + "properties": { + "databaseName": "testdb", + "operation": "UpdateLogicalDatabase", + "operationFriendlyName": "ALTER DATABASE", + "percentComplete": 100, + "serverName": "testsvr", + "startTime": "2023-02-24T11:48:29.16Z", + "state": "Failed", + "errorCode": 40640, + "errorDescription": "The server encountered an unexpected exception.", + "errorSeverity": 20, + "isUserError": true, + "description": "'UpdateLogicalDatabase' on database 'testdb'" + } } ] }