Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger changes to introduce REST APIs for offline and online region for the Cosmos DB account #2962

Merged
merged 10 commits into from
May 9, 2018
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,100 @@
}
}
},
"/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.",
"x-ms-long-running-operation": true,
"parameters": [
{
"$ref": "#/parameters/subscriptionIdParameter"
},
{
"$ref": "#/parameters/resourceGroupNameParameter"
},
{
"$ref": "#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"name": "regionParameterForOffline",
"in": "body",
"required": true,
"description": "Cosmos DB region to offline for the database account.",
"schema": {
"$ref": "#/definitions/RegionForOnlineOffline"
}
}
],
"responses": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a "default" response to capture all the error responses. The schema complies with ARM RPC error contract. Example can be found Batch RP swagger spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ravbhatnagar I have added a default error response. Can you please review.

"200": {
"description": "The offline region operation is completed successfully."
},
"202": {
"description": "Accepted. The offline region operation will complete asynchronously."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/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.",
"x-ms-long-running-operation": true,
"parameters": [
{
"$ref": "#/parameters/subscriptionIdParameter"
},
{
"$ref": "#/parameters/resourceGroupNameParameter"
},
{
"$ref": "#/parameters/accountNameParameter"
},
{
"$ref": "#/parameters/apiVersionParameter"
},
{
"name": "regionParameterForOnline",
"in": "body",
"required": true,
"description": "Cosmos DB region to online for the database account.",
"schema": {
"$ref": "#/definitions/RegionForOnlineOffline"
}
}
],
"responses": {
"200": {
"description": "The online region operation is completed successfully."
},
"202": {
"description": "Accepted. The online region operation will complete asynchronously."
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys": {
"get": {
"operationId": "DatabaseAccounts_ListReadOnlyKeys",
Expand Down Expand Up @@ -1261,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": {
Expand Down Expand Up @@ -1297,6 +1404,18 @@
}
}
},
"RegionForOnlineOffline": {
"properties": {
"region": {
"type": "string",
"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.",
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parameters": {
"accountName": "ddb1",
"resourceGroupName": "rg1",
"api-version": "2015-04-08",
"subscriptionId": "subid",
"region":"North Europe"
},
"responses": {
"200": { },
"202": { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parameters": {
"accountName": "ddb1",
"resourceGroupName": "rg1",
"api-version": "2015-04-08",
"subscriptionId": "subid",
"region":"North Europe"
},
"responses": {
"200": { },
"202": { }
}
}