From fc2e0c27e6646213b50312cb2f17b3767108db0a Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Thu, 26 Apr 2018 16:02:33 -0700 Subject: [PATCH 01/10] Swagger changes to introduce REST APIs for offline and online region --- .../stable/2015-04-08/cosmos-db.json | 68 +++++++++++++++++++ .../CosmosDBDatabaseAccountOfflineRegion.json | 13 ++++ .../CosmosDBDatabaseAccountOnlineRegion.json | 13 ++++ 3 files changed, 94 insertions(+) create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOfflineRegion.json create mode 100644 specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOnlineRegion.json diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index ef31745c691c..43b6989eb452 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -337,6 +337,74 @@ } } }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion": { + "post": { + "operationId": "DatabaseAccounts_OfflineRegion", + "x-ms-examples": { + "CosmosDBDatabaseAccountOfflineRegion": { "$ref": "./examples/CosmosDBDatabaseAccountOfflineRegion.json" } + }, + "description": "Offline the specified region for the specified Azure Cosmos DB database account.", + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "$ref": "#/parameters/regionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted. The offline region operation will complete asynchronously." + }, + "200": { + "description": "The offline region operation is completed successfully.", + } + } + } + }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion": { + "post": { + "operationId": "DatabaseAccounts_OnlineRegion", + "x-ms-examples": { + "CosmosDBDatabaseAccountOnlineRegion": { "$ref": "./examples/CosmosDBDatabaseAccountOnlineRegion.json" } + }, + "description": "Online the specified region for the specified Azure Cosmos DB database account.", + "parameters": [ + { + "$ref": "#/parameters/subscriptionIdParameter" + }, + { + "$ref": "#/parameters/resourceGroupNameParameter" + }, + { + "$ref": "#/parameters/accountNameParameter" + }, + { + "$ref": "#/parameters/apiVersionParameter" + }, + { + "$ref": "#/parameters/regionParameter" + } + ], + "responses": { + "202": { + "description": "Accepted. The online region operation will complete asynchronously." + }, + "200": { + "description": "The online region operation is completed successfully.", + } + } + } + }, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys": { "get": { "operationId": "DatabaseAccounts_ListReadOnlyKeys", diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOfflineRegion.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOfflineRegion.json new file mode 100644 index 000000000000..bd8dec50b239 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOfflineRegion.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "accountName": "ddb1", + "resourceGroupName": "rg1", + "api-version": "2015-04-08", + "subscriptionId": "subid", + "region":"North Europe" + }, + "responses": { + "200": { }, + "202": { } + } +} \ No newline at end of file diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOnlineRegion.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOnlineRegion.json new file mode 100644 index 000000000000..bd8dec50b239 --- /dev/null +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/examples/CosmosDBDatabaseAccountOnlineRegion.json @@ -0,0 +1,13 @@ +{ + "parameters": { + "accountName": "ddb1", + "resourceGroupName": "rg1", + "api-version": "2015-04-08", + "subscriptionId": "subid", + "region":"North Europe" + }, + "responses": { + "200": { }, + "202": { } + } +} \ No newline at end of file From 754d78c5a788ddeeb4157130fc57e61666724953 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Thu, 26 Apr 2018 16:28:32 -0700 Subject: [PATCH 02/10] mark the offline and online apis as long running operations --- .../Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 43b6989eb452..bf50b517b1c9 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -344,6 +344,7 @@ "CosmosDBDatabaseAccountOfflineRegion": { "$ref": "./examples/CosmosDBDatabaseAccountOfflineRegion.json" } }, "description": "Offline the specified region for the specified Azure Cosmos DB database account.", + "x-ms-long-running-operation": true, "parameters": [ { "$ref": "#/parameters/subscriptionIdParameter" @@ -378,6 +379,7 @@ "CosmosDBDatabaseAccountOnlineRegion": { "$ref": "./examples/CosmosDBDatabaseAccountOnlineRegion.json" } }, "description": "Online the specified region for the specified Azure Cosmos DB database account.", + "x-ms-long-running-operation": true, "parameters": [ { "$ref": "#/parameters/subscriptionIdParameter" From f874740b2a678460b05083d316f0332701c43df7 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Thu, 26 Apr 2018 17:07:29 -0700 Subject: [PATCH 03/10] fix the compiling error for the json --- .../stable/2015-04-08/cosmos-db.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index bf50b517b1c9..27e840791a10 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -363,11 +363,11 @@ } ], "responses": { + "200": { + "description": "The offline region operation is completed successfully." + }, "202": { "description": "Accepted. The offline region operation will complete asynchronously." - }, - "200": { - "description": "The offline region operation is completed successfully.", } } } @@ -398,11 +398,11 @@ } ], "responses": { + "200": { + "description": "The online region operation is completed successfully." + }, "202": { "description": "Accepted. The online region operation will complete asynchronously." - }, - "200": { - "description": "The online region operation is completed successfully.", } } } From fa9bc3028e4c1394bab3ee2c29bcfaaae752cb1b Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Thu, 26 Apr 2018 17:49:18 -0700 Subject: [PATCH 04/10] define a new region parameter for online/offline --- .../stable/2015-04-08/cosmos-db.json | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 27e840791a10..af007e8832ae 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -359,7 +359,7 @@ "$ref": "#/parameters/apiVersionParameter" }, { - "$ref": "#/parameters/regionParameter" + "$ref": "#/parameters/regionParameterForOnlineOffline" } ], "responses": { @@ -394,7 +394,7 @@ "$ref": "#/parameters/apiVersionParameter" }, { - "$ref": "#/parameters/regionParameter" + "$ref": "#/parameters/regionParameterForOnlineOffline" } ], "responses": { @@ -2341,6 +2341,14 @@ "x-ms-parameter-location": "method", "description": "Cosmos DB region, with spaces between words and each word capitalized." }, + "regionParameterForOnlineOffline": { + "name": "region", + "in": "query", + "required": true, + "type": "string", + "x-ms-parameter-location": "method", + "description": "Cosmos DB region, with spaces between words and each word capitalized." + }, "sourceRegionParameter": { "name": "sourceRegion", "in": "path", From 8a4a624ca4d11da91556b04681058715abb52934 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Mon, 30 Apr 2018 14:58:02 -0700 Subject: [PATCH 05/10] fix the bug where the region parameter was part of query instead of body --- .../Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index af007e8832ae..32518b2a5e74 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -2343,7 +2343,7 @@ }, "regionParameterForOnlineOffline": { "name": "region", - "in": "query", + "in": "body", "required": true, "type": "string", "x-ms-parameter-location": "method", From 42bc198a0597bde05394ba1c1bd21d068d339055 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Mon, 30 Apr 2018 15:45:27 -0700 Subject: [PATCH 06/10] actually fixing the bug where the region parameter was part of query instead of body --- .../stable/2015-04-08/cosmos-db.json | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 32518b2a5e74..41bc0ccde974 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -359,7 +359,12 @@ "$ref": "#/parameters/apiVersionParameter" }, { - "$ref": "#/parameters/regionParameterForOnlineOffline" + "name": "regionParameterForOffline", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RegionForOnlineOffline" + } } ], "responses": { @@ -394,7 +399,12 @@ "$ref": "#/parameters/apiVersionParameter" }, { - "$ref": "#/parameters/regionParameterForOnlineOffline" + "name": "regionParameterForOnline", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/RegionForOnlineOffline" + } } ], "responses": { @@ -1367,6 +1377,17 @@ } } }, + "RegionForOnlineOffline": { + "type": "object", + "description": "Cosmos DB region to online or offline." + "properties": { + "region": { + "type": "string", + "readOnly": true, + "description": "Cosmos DB region, with spaces between words and each word capitalized." + } + } + }, "Location": { "description": "A region in which the Azure Cosmos DB database account is deployed.", "type": "object", @@ -2341,14 +2362,6 @@ "x-ms-parameter-location": "method", "description": "Cosmos DB region, with spaces between words and each word capitalized." }, - "regionParameterForOnlineOffline": { - "name": "region", - "in": "body", - "required": true, - "type": "string", - "x-ms-parameter-location": "method", - "description": "Cosmos DB region, with spaces between words and each word capitalized." - }, "sourceRegionParameter": { "name": "sourceRegion", "in": "path", From ab30108303e8b0af64abcac225babb39f1040974 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Mon, 30 Apr 2018 16:18:33 -0700 Subject: [PATCH 07/10] actually fixing the bug where the region parameter was part of query instead of body --- .../Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 41bc0ccde974..c6ccaae36e83 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -1379,7 +1379,7 @@ }, "RegionForOnlineOffline": { "type": "object", - "description": "Cosmos DB region to online or offline." + "description": "Cosmos DB region to online or offline.", "properties": { "region": { "type": "string", From 05246bcf53fa84862f145b8ffda5258b4427faf3 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Mon, 30 Apr 2018 16:37:01 -0700 Subject: [PATCH 08/10] actually fixing the bug where the region parameter was part of query instead of body and adding the description --- .../Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index c6ccaae36e83..36b6cc418ab9 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -362,6 +362,7 @@ "name": "regionParameterForOffline", "in": "body", "required": true, + "description": "Cosmos DB region to offline for the database account.", "schema": { "$ref": "#/definitions/RegionForOnlineOffline" } @@ -402,6 +403,7 @@ "name": "regionParameterForOnline", "in": "body", "required": true, + "description": "Cosmos DB region to online for the database account.", "schema": { "$ref": "#/definitions/RegionForOnlineOffline" } From f2366fb3019c4625f0351dbf06bf4af52c814f6c Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Tue, 1 May 2018 15:30:38 -0700 Subject: [PATCH 09/10] another try to specify the correct swagger changes --- .../stable/2015-04-08/cosmos-db.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 36b6cc418ab9..6f1bf84d286b 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -1380,15 +1380,16 @@ } }, "RegionForOnlineOffline": { - "type": "object", - "description": "Cosmos DB region to online or offline.", "properties": { "region": { "type": "string", - "readOnly": true, "description": "Cosmos DB region, with spaces between words and each word capitalized." } - } + }, + "required": [ + "region" + ], + "description": "Cosmos DB region to online or offline." }, "Location": { "description": "A region in which the Azure Cosmos DB database account is deployed.", From 90571350169f9fa1de9d74a9588479d776cae2b8 Mon Sep 17 00:00:00 2001 From: arsalana-microsoft <38569281+arsalana-microsoft@users.noreply.github.com> Date: Tue, 8 May 2018 14:15:31 -0700 Subject: [PATCH 10/10] Added default error response --- .../stable/2015-04-08/cosmos-db.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json index 6f1bf84d286b..5d89afa938db 100644 --- a/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json +++ b/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2015-04-08/cosmos-db.json @@ -374,6 +374,12 @@ }, "202": { "description": "Accepted. The offline region operation will complete asynchronously." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } } } } @@ -415,6 +421,12 @@ }, "202": { "description": "Accepted. The online region operation will complete asynchronously." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } } } } @@ -1343,6 +1355,19 @@ }, "description": "The List operation response, that contains the database accounts and their properties." }, + "ErrorResponse": { + "properties": { + "code": { + "description": "Error code.", + "type": "string" + }, + "message": { + "description": "Error message indicating why the operation failed.", + "type": "string" + } + }, + "description": "Error Response." + }, "FailoverPolicies": { "properties": { "failoverPolicies": {