Skip to content

Commit

Permalink
Cosmos DB patch and multi-api support (#7336)
Browse files Browse the repository at this point in the history
* adding patch support in new API version, adding multiapi support for python, go, java, adding new property from database account resource, adding locations to response of database accounts

* removing api kind from one example

* adding partition key version, removing new property from old api version

* revert changes to old api swagger

* rebasing and adding preview versions to sdk generation

* create or update method with guidance in the description

* renaming create variables

* minor text changes
  • Loading branch information
shurd authored and ArcturusZhang committed Oct 30, 2019
1 parent 9ea7ae9 commit 86a2a68
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@
}
},
"patch": {
"operationId": "DatabaseAccounts_Patch",
"operationId": "DatabaseAccounts_Update",
"x-ms-examples": {
"CosmosDBDatabaseAccountPatch": {
"$ref": "./examples/CosmosDBDatabaseAccountPatch.json"
}
},
"description": "Patches the properties of an existing Azure Cosmos DB database account.",
"description": "Updates the properties of an existing Azure Cosmos DB database account.",
"x-ms-long-running-operation": true,
"parameters": [
{
Expand All @@ -93,14 +93,14 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/DatabaseAccountPatchParameters"
"$ref": "#/definitions/DatabaseAccountUpdateParameters"
},
"description": "The tags parameter to patch for the current database account."
"description": "The parameters to provide for the current database account."
}
],
"responses": {
"200": {
"description": "The properties of the database account were patched successfully.",
"description": "The database account update operation will complete asynchronously.",
"schema": {
"$ref": "#/definitions/DatabaseAccountGetResults"
}
Expand All @@ -117,7 +117,7 @@
"$ref": "./examples/CosmosDBDatabaseAccountCreateMax.json"
}
},
"description": "Creates or updates an Azure Cosmos DB database account.",
"description": "Creates or updates an Azure Cosmos DB database account. The \"Update\" method is preferred when performing updates on an account.",
"x-ms-long-running-operation": true,
"parameters": [
{
Expand Down Expand Up @@ -5012,6 +5012,14 @@
"$ref": "#/definitions/Location"
}
},
"locations": {
"type": "array",
"readOnly": true,
"description": "An array that contains all of the locations enabled for the Cosmos DB account.",
"items": {
"$ref": "#/definitions/Location"
}
},
"failoverPolicies": {
"type": "array",
"readOnly": true,
Expand All @@ -5038,19 +5046,10 @@
"connectorOffer": {
"description": "The cassandra connector offer type for the Cosmos DB database C* account.",
"$ref": "#/definitions/ConnectorOffer"
}
}
},
"DatabaseAccountPatchProperties": {
"description": "Properties to update Azure Cosmos DB database accounts.",
"type": "object",
"properties": {
"capabilities": {
"type": "array",
"description": "List of Cosmos DB capabilities for the account",
"items": {
"$ref": "#/definitions/Capability"
}
},
"disableKeyBasedMetadataWriteAccess": {
"description": "Disable write operations on metadata resources (databases, containers, throughput) via account keys",
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -5110,6 +5109,10 @@
"connectorOffer": {
"description": "The cassandra connector offer type for the Cosmos DB database C* account.",
"$ref": "#/definitions/ConnectorOffer"
},
"disableKeyBasedMetadataWriteAccess": {
"description": "Disable write operations on metadata resources (databases, containers, throughput) via account keys",
"type": "boolean"
}
},
"required": [
Expand Down Expand Up @@ -5149,16 +5152,79 @@
"properties"
]
},
"DatabaseAccountPatchParameters": {
"DatabaseAccountUpdateProperties": {
"description": "Properties to update Azure Cosmos DB database accounts.",
"type": "object",
"properties": {
"consistencyPolicy": {
"description": "The consistency policy for the Cosmos DB account.",
"$ref": "#/definitions/ConsistencyPolicy"
},
"locations": {
"type": "array",
"description": "An array that contains the georeplication locations enabled for the Cosmos DB account.",
"items": {
"$ref": "#/definitions/Location"
}
},
"ipRangeFilter": {
"description": "Cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces.",
"$ref": "#/definitions/IPRangeFilter"
},
"isVirtualNetworkFilterEnabled": {
"description": "Flag to indicate whether to enable/disable Virtual Network ACL rules.",
"type": "boolean"
},
"enableAutomaticFailover": {
"description": "Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account.",
"type": "boolean"
},
"capabilities": {
"type": "array",
"description": "List of Cosmos DB capabilities for the account",
"items": {
"$ref": "#/definitions/Capability"
}
},
"virtualNetworkRules": {
"type": "array",
"description": "List of Virtual Network ACL rules configured for the Cosmos DB account.",
"items": {
"$ref": "#/definitions/VirtualNetworkRule"
}
},
"enableMultipleWriteLocations": {
"description": "Enables the account to write in multiple locations",
"type": "boolean"
},
"enableCassandraConnector": {
"description": "Enables the cassandra connector on the Cosmos DB C* account",
"type": "boolean"
},
"connectorOffer": {
"description": "The cassandra connector offer type for the Cosmos DB database C* account.",
"$ref": "#/definitions/ConnectorOffer"
},
"disableKeyBasedMetadataWriteAccess": {
"description": "Disable write operations on metadata resources (databases, containers, throughput) via account keys",
"type": "boolean"
}
}
},
"DatabaseAccountUpdateParameters": {
"description": "Parameters for patching Azure Cosmos DB database account properties.",
"type": "object",
"properties": {
"tags": {
"$ref": "#/definitions/Tags"
},
"location": {
"type": "string",
"description": "The location of the resource group to which the resource belongs."
},
"properties": {
"x-ms-client-flatten": true,
"$ref": "#/definitions/DatabaseAccountPatchProperties"
"$ref": "#/definitions/DatabaseAccountUpdateProperties"
}
}
},
Expand Down Expand Up @@ -5931,6 +5997,13 @@
"name": "PartitionKind",
"modelAsString": true
}
},
"version": {
"description": "Indicates the version of the partition key definition",
"type": "integer",
"minimum": 1,
"maximum": 2,
"format": "int32"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"ipRangeFilter": "10.10.10.10",
"isVirtualNetworkFilterEnabled": true,
"databaseAccountOfferType": "Standard",
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "BoundedStaleness",
"maxIntervalInSeconds": 10,
Expand Down Expand Up @@ -82,6 +83,22 @@
"isZoneRedundant": false
}
],
"locations": [
{
"id": "ddb1-southcentralus",
"locationName": "South Central US",
"provisioningState": "Initializing",
"failoverPriority": 0,
"isZoneRedundant": false
},
{
"id": "ddb1-eastus",
"locationName": "East US",
"provisioningState": "Initializing",
"failoverPriority": 1,
"isZoneRedundant": false
}
],
"failoverPolicies": [
{
"id": "ddb1-southcentralus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"provisioningState": "Initializing",
"ipRangeFilter": "",
"databaseAccountOfferType": "Standard",
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
Expand All @@ -54,6 +55,15 @@
"isZoneRedundant": false
}
],
"locations": [
{
"id": "ddb1-southcentralus",
"locationName": "South Central US",
"provisioningState": "Initializing",
"failoverPriority": 0,
"isZoneRedundant": false
}
],
"failoverPolicies": [
{
"id": "ddb1-southcentralus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"isVirtualNetworkFilterEnabled": false,
"virtualNetworkRules": [],
"databaseAccountOfferType": "Standard",
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
Expand All @@ -44,6 +45,15 @@
"failoverPriority": 0
}
],
"locations": [
{
"id": "ddb1-eastus",
"locationName": "East US",
"documentEndpoint": "https://ddb1-eastus.documents.azure.com:443/",
"provisioningState": "Succeeded",
"failoverPriority": 0
}
],
"failoverPolicies": [
{
"id": "ddb1-eastus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"documentEndpoint": "https://ddb1.documents.azure.com:443/",
"ipRangeFilter": "",
"databaseAccountOfferType": "Standard",
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
Expand All @@ -42,6 +43,15 @@
"failoverPriority": 0
}
],
"locations": [
{
"id": "ddb1-eastus",
"locationName": "East US",
"documentEndpoint": "https://ddb1-eastus.documents.azure.com:443/",
"provisioningState": "Succeeded",
"failoverPriority": 0
}
],
"failoverPolicies": [
{
"id": "ddb1-eastus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"documentEndpoint": "https://ddb1.documents.azure.com:443/",
"ipRangeFilter": "",
"databaseAccountOfferType": "Standard",
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
Expand All @@ -43,6 +44,15 @@
"failoverPriority": 0
}
],
"locations": [
{
"id": "ddb1-eastus",
"locationName": "East US",
"documentEndpoint": "https://ddb1-eastus.documents.azure.com:443/",
"provisioningState": "Succeeded",
"failoverPriority": 0
}
],
"failoverPolicies": [
{
"id": "ddb1-eastus",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,24 @@
"api-version": "2019-08-01",
"subscriptionId": "subid",
"updateParameters": {
"location": "westus",
"tags": {
"dept": "finance"
},
"properties": {
"ipRangeFilter": "10.10.10.10",
"isVirtualNetworkFilterEnabled": true,
"virtualNetworkRules": [
{
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
"ignoreMissingVNetServiceEndpoint": false
}
],
"consistencyPolicy": {
"defaultConsistencyLevel": "BoundedStaleness",
"maxIntervalInSeconds": 10,
"maxStalenessPrefix": 200
}
}
}
},
Expand All @@ -18,16 +34,20 @@
"location": "West US",
"type": "Microsoft.DocumentDB/databaseAccounts",
"kind": "GlobalDocumentDB",
"tags": {},
"tags": {
"dept": "finance"
},
"properties": {
"provisioningState": "Succeeded",
"documentEndpoint": "https://ddb1.documents.azure.com:443/",
"ipRangeFilter": "",
"databaseAccountOfferType": "Standard",
"ipRangeFilter": "10.10.10.10",
"isVirtualNetworkFilterEnabled": true,
"disableKeyBasedMetadataWriteAccess": false,
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
"defaultConsistencyLevel": "BoundedStaleness",
"maxIntervalInSeconds": 10,
"maxStalenessPrefix": 200
},
"writeLocations": [
{
Expand All @@ -47,12 +67,27 @@
"failoverPriority": 0
}
],
"locations": [
{
"id": "ddb1-eastus",
"locationName": "East US",
"documentEndpoint": "https://ddb1-eastus.documents.azure.com:443/",
"provisioningState": "Succeeded",
"failoverPriority": 0
}
],
"failoverPolicies": [
{
"id": "ddb1-eastus",
"locationName": "East US",
"failoverPriority": 0
}
],
"virtualNetworkRules": [
{
"id": "/subscriptions/subId/resourceGroups/rg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1",
"ignoreMissingVNetServiceEndpoint": false
}
]
}
}
Expand Down
Loading

0 comments on commit 86a2a68

Please sign in to comment.