From 62bd1cfdbe02f9d7c27b5e948cee98bf048d72a6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 12 Apr 2018 13:41:29 -0700 Subject: [PATCH 1/4] Generated from f4de45b64671c46afe8ce792c163c2dcc92f9988 (#2671) Undo Test --- lib/services/cosmosdbManagement/LICENSE.txt | 42 +++++----- lib/services/cosmosdbManagement/README.md | 84 +++++++++---------- .../lib/models/databaseAccount.js | 26 ++++++ .../databaseAccountCreateUpdateParameters.js | 26 ++++++ .../cosmosdbManagement/lib/models/index.d.ts | 25 ++++++ .../cosmosdbManagement/lib/models/index.js | 1 + .../lib/models/virtualNetworkRule.js | 53 ++++++++++++ .../lib/operations/databaseAccounts.js | 36 ++++++++ .../lib/operations/index.d.ts | 24 ++++++ lib/services/cosmosdbManagement/package.json | 2 +- 10 files changed, 255 insertions(+), 64 deletions(-) create mode 100644 lib/services/cosmosdbManagement/lib/models/virtualNetworkRule.js diff --git a/lib/services/cosmosdbManagement/LICENSE.txt b/lib/services/cosmosdbManagement/LICENSE.txt index a70e8cf660..5431ba98b9 100644 --- a/lib/services/cosmosdbManagement/LICENSE.txt +++ b/lib/services/cosmosdbManagement/LICENSE.txt @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2018 Microsoft - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/cosmosdbManagement/README.md b/lib/services/cosmosdbManagement/README.md index f0a84e6141..3bcee1efce 100644 --- a/lib/services/cosmosdbManagement/README.md +++ b/lib/services/cosmosdbManagement/README.md @@ -1,42 +1,42 @@ ---- -uid: azure-arm-cosmosdb -summary: *content - ---- -# Microsoft Azure SDK for Node.js - CosmosDBManagementClient -This project provides a Node.js package for accessing Azure. Right now it supports: -- **Node.js version 6.x.x or higher** - -## Features - - -## How to Install - -```bash -npm install azure-arm-cosmosdb -``` - -## How to use - -### Authentication, client creation and get databaseAccounts as an example. - -```javascript -const msRestAzure = require("ms-rest-azure"); -const CosmosDBManagementClient = require("azure-arm-cosmosdb"); -msRestAzure.interactiveLogin().then((creds) => { - const subscriptionId = ""; - const client = new CosmosDBManagementClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const accountName = "testaccountName"; - return client.databaseAccounts.get(resourceGroupName, accountName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.log('An error ocurred:'); - console.dir(err, {depth: null, colors: true}); -}); - -## Related projects - -- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) +--- +uid: azure-arm-cosmosdb +summary: *content + +--- +# Microsoft Azure SDK for Node.js - CosmosDBManagementClient +This project provides a Node.js package for accessing Azure. Right now it supports: +- **Node.js version 6.x.x or higher** + +## Features + + +## How to Install + +```bash +npm install azure-arm-cosmosdb +``` + +## How to use + +### Authentication, client creation and get databaseAccounts as an example. + +```javascript +const msRestAzure = require("ms-rest-azure"); +const CosmosDBManagementClient = require("azure-arm-cosmosdb"); +msRestAzure.interactiveLogin().then((creds) => { + const subscriptionId = ""; + const client = new CosmosDBManagementClient(creds, subscriptionId); + const resourceGroupName = "testresourceGroupName"; + const accountName = "testaccountName"; + return client.databaseAccounts.get(resourceGroupName, accountName).then((result) => { + console.log("The result is:"); + console.log(result); + }); +}).catch((err) => { + console.log('An error occurred:'); + console.dir(err, {depth: null, colors: true}); +}); + +## Related projects + +- [Microsoft Azure SDK for Node.js](https://github.com/Azure/azure-sdk-for-node) diff --git a/lib/services/cosmosdbManagement/lib/models/databaseAccount.js b/lib/services/cosmosdbManagement/lib/models/databaseAccount.js index 8e20ef2275..64a3d7a2f4 100644 --- a/lib/services/cosmosdbManagement/lib/models/databaseAccount.js +++ b/lib/services/cosmosdbManagement/lib/models/databaseAccount.js @@ -35,6 +35,8 @@ class DatabaseAccount extends models['Resource'] { * 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. + * @member {boolean} [isVirtualNetworkFilterEnabled] Flag to indicate whether + * to enable/disable Virtual Network ACL rules. * @member {boolean} [enableAutomaticFailover] 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 @@ -64,6 +66,8 @@ class DatabaseAccount extends models['Resource'] { * locations enabled for the Cosmos DB account. * @member {array} [failoverPolicies] An array that contains the regions * ordered by their failover priorities. + * @member {array} [virtualNetworkRules] List of Virtual Network ACL rules + * configured for the Cosmos DB account. */ constructor() { super(); @@ -167,6 +171,13 @@ class DatabaseAccount extends models['Resource'] { name: 'String' } }, + isVirtualNetworkFilterEnabled: { + required: false, + serializedName: 'properties.isVirtualNetworkFilterEnabled', + type: { + name: 'Boolean' + } + }, enableAutomaticFailover: { required: false, serializedName: 'properties.enableAutomaticFailover', @@ -244,6 +255,21 @@ class DatabaseAccount extends models['Resource'] { } } } + }, + virtualNetworkRules: { + required: false, + serializedName: 'properties.virtualNetworkRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkRuleElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkRule' + } + } + } } } } diff --git a/lib/services/cosmosdbManagement/lib/models/databaseAccountCreateUpdateParameters.js b/lib/services/cosmosdbManagement/lib/models/databaseAccountCreateUpdateParameters.js index 6980ed3484..3640bae083 100644 --- a/lib/services/cosmosdbManagement/lib/models/databaseAccountCreateUpdateParameters.js +++ b/lib/services/cosmosdbManagement/lib/models/databaseAccountCreateUpdateParameters.js @@ -47,6 +47,8 @@ class DatabaseAccountCreateUpdateParameters extends models['Resource'] { * 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. + * @member {boolean} [isVirtualNetworkFilterEnabled] Flag to indicate whether + * to enable/disable Virtual Network ACL rules. * @member {boolean} [enableAutomaticFailover] 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 @@ -54,6 +56,8 @@ class DatabaseAccountCreateUpdateParameters extends models['Resource'] { * account. * @member {array} [capabilities] List of Cosmos DB capabilities for the * account + * @member {array} [virtualNetworkRules] List of Virtual Network ACL rules + * configured for the Cosmos DB account. */ constructor() { super(); @@ -165,6 +169,13 @@ class DatabaseAccountCreateUpdateParameters extends models['Resource'] { name: 'String' } }, + isVirtualNetworkFilterEnabled: { + required: false, + serializedName: 'properties.isVirtualNetworkFilterEnabled', + type: { + name: 'Boolean' + } + }, enableAutomaticFailover: { required: false, serializedName: 'properties.enableAutomaticFailover', @@ -186,6 +197,21 @@ class DatabaseAccountCreateUpdateParameters extends models['Resource'] { } } } + }, + virtualNetworkRules: { + required: false, + serializedName: 'properties.virtualNetworkRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkRuleElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkRule' + } + } + } } } } diff --git a/lib/services/cosmosdbManagement/lib/models/index.d.ts b/lib/services/cosmosdbManagement/lib/models/index.d.ts index eed218fe12..e9a69fa5b6 100644 --- a/lib/services/cosmosdbManagement/lib/models/index.d.ts +++ b/lib/services/cosmosdbManagement/lib/models/index.d.ts @@ -102,6 +102,19 @@ export interface FailoverPolicy { failoverPriority?: number; } +/** + * @class + * Initializes a new instance of the VirtualNetworkRule class. + * @constructor + * Virtual Network ACL Rule object + * + * @member {string} [id] Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ +export interface VirtualNetworkRule { + id?: string; +} + /** * @class * Initializes a new instance of the Resource class. @@ -143,6 +156,8 @@ export interface Resource extends BaseResource { * 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. + * @member {boolean} [isVirtualNetworkFilterEnabled] Flag to indicate whether + * to enable/disable Virtual Network ACL rules. * @member {boolean} [enableAutomaticFailover] 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 @@ -170,6 +185,8 @@ export interface Resource extends BaseResource { * enabled for the Cosmos DB account. * @member {array} [failoverPolicies] An array that contains the regions * ordered by their failover priorities. + * @member {array} [virtualNetworkRules] List of Virtual Network ACL rules + * configured for the Cosmos DB account. */ export interface DatabaseAccount extends Resource { kind?: string; @@ -177,12 +194,14 @@ export interface DatabaseAccount extends Resource { readonly documentEndpoint?: string; readonly databaseAccountOfferType?: string; ipRangeFilter?: string; + isVirtualNetworkFilterEnabled?: boolean; enableAutomaticFailover?: boolean; consistencyPolicy?: ConsistencyPolicy; capabilities?: Capability[]; readonly writeLocations?: Location[]; readonly readLocations?: Location[]; readonly failoverPolicies?: FailoverPolicy[]; + virtualNetworkRules?: VirtualNetworkRule[]; } /** @@ -227,20 +246,26 @@ export interface FailoverPolicies { * 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. + * @member {boolean} [isVirtualNetworkFilterEnabled] Flag to indicate whether + * to enable/disable Virtual Network ACL rules. * @member {boolean} [enableAutomaticFailover] 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. * @member {array} [capabilities] List of Cosmos DB capabilities for the * account + * @member {array} [virtualNetworkRules] List of Virtual Network ACL rules + * configured for the Cosmos DB account. */ export interface DatabaseAccountCreateUpdateParameters extends Resource { kind?: string; consistencyPolicy?: ConsistencyPolicy; locations: Location[]; ipRangeFilter?: string; + isVirtualNetworkFilterEnabled?: boolean; enableAutomaticFailover?: boolean; capabilities?: Capability[]; + virtualNetworkRules?: VirtualNetworkRule[]; } /** diff --git a/lib/services/cosmosdbManagement/lib/models/index.js b/lib/services/cosmosdbManagement/lib/models/index.js index e4dcac5f25..3436075692 100644 --- a/lib/services/cosmosdbManagement/lib/models/index.js +++ b/lib/services/cosmosdbManagement/lib/models/index.js @@ -22,6 +22,7 @@ exports.ConsistencyPolicy = require('./consistencyPolicy'); exports.Capability = require('./capability'); exports.Location = require('./location'); exports.FailoverPolicy = require('./failoverPolicy'); +exports.VirtualNetworkRule = require('./virtualNetworkRule'); exports.Resource = require('./resource'); exports.DatabaseAccount = require('./databaseAccount'); exports.FailoverPolicies = require('./failoverPolicies'); diff --git a/lib/services/cosmosdbManagement/lib/models/virtualNetworkRule.js b/lib/services/cosmosdbManagement/lib/models/virtualNetworkRule.js new file mode 100644 index 0000000000..787449b51a --- /dev/null +++ b/lib/services/cosmosdbManagement/lib/models/virtualNetworkRule.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Virtual Network ACL Rule object + * + */ +class VirtualNetworkRule { + /** + * Create a VirtualNetworkRule. + * @member {string} [id] Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkRule + * + * @returns {object} metadata of VirtualNetworkRule + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkRule', + type: { + name: 'Composite', + className: 'VirtualNetworkRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkRule; diff --git a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js index 442f391ca0..d1f84412e5 100644 --- a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js +++ b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js @@ -316,6 +316,9 @@ function _patch(resourceGroupName, accountName, updateParameters, options, callb * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -325,6 +328,9 @@ function _patch(resourceGroupName, accountName, updateParameters, options, callb * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -2306,6 +2312,9 @@ function _beginPatch(resourceGroupName, accountName, updateParameters, options, * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -2315,6 +2324,9 @@ function _beginPatch(resourceGroupName, accountName, updateParameters, options, * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -3270,6 +3282,9 @@ class DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -3279,6 +3294,9 @@ class DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -3355,6 +3373,9 @@ class DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -3364,6 +3385,9 @@ class DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -4646,6 +4670,9 @@ class DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -4655,6 +4682,9 @@ class DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -4731,6 +4761,9 @@ class DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -4740,6 +4773,9 @@ class DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * diff --git a/lib/services/cosmosdbManagement/lib/operations/index.d.ts b/lib/services/cosmosdbManagement/lib/operations/index.d.ts index 0885bfe80a..1073980bde 100644 --- a/lib/services/cosmosdbManagement/lib/operations/index.d.ts +++ b/lib/services/cosmosdbManagement/lib/operations/index.d.ts @@ -201,6 +201,9 @@ export interface DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -210,6 +213,9 @@ export interface DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -274,6 +280,9 @@ export interface DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -283,6 +292,9 @@ export interface DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -1199,6 +1211,9 @@ export interface DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -1208,6 +1223,9 @@ export interface DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * @@ -1272,6 +1290,9 @@ export interface DatabaseAccounts { * database account. IP addresses/ranges must be comma separated and must not * contain any spaces. * + * @param {boolean} [createUpdateParameters.isVirtualNetworkFilterEnabled] Flag + * to indicate whether to enable/disable Virtual Network ACL rules. + * * @param {boolean} [createUpdateParameters.enableAutomaticFailover] 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 @@ -1281,6 +1302,9 @@ export interface DatabaseAccounts { * @param {array} [createUpdateParameters.capabilities] List of Cosmos DB * capabilities for the account * + * @param {array} [createUpdateParameters.virtualNetworkRules] List of Virtual + * Network ACL rules configured for the Cosmos DB account. + * * @param {string} createUpdateParameters.location The location of the resource * group to which the resource belongs. * diff --git a/lib/services/cosmosdbManagement/package.json b/lib/services/cosmosdbManagement/package.json index 6b9a707b6e..92ec1639b8 100644 --- a/lib/services/cosmosdbManagement/package.json +++ b/lib/services/cosmosdbManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-cosmosdb", "author": "Microsoft Corporation", "description": "CosmosDBManagementClient Library with typescript type definitions for node", - "version": "1.1.2", + "version": "1.1.1-preview", "dependencies": { "ms-rest": "^2.3.2", "ms-rest-azure": "^2.5.5" From 5888dc1ca482692e171959bb3c89337041f154ab Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 9 May 2018 11:34:23 -0700 Subject: [PATCH 2/4] [AutoPR cosmos-db/resource-manager] Swagger changes to introduce REST APIs for offline and online region for the Cosmos DB account (#2806) * Generated from f874740b2a678460b05083d316f0332701c43df7 fix the compiling error for the json * Generated from fa9bc3028e4c1394bab3ee2c29bcfaaae752cb1b define a new region parameter for online/offline * Generated from ab30108303e8b0af64abcac225babb39f1040974 actually fixing the bug where the region parameter was part of query instead of body * Generated from f2366fb3019c4625f0351dbf06bf4af52c814f6c another try to specify the correct swagger changes * Generated from 90571350169f9fa1de9d74a9588479d776cae2b8 Added default error response --- .../lib/models/errorResponse.js | 61 + .../cosmosdbManagement/lib/models/index.d.ts | 28 + .../cosmosdbManagement/lib/models/index.js | 2 + .../lib/models/regionForOnlineOffline.js | 53 + .../lib/operations/databaseAccounts.js | 1166 +++++++++++++++-- .../lib/operations/index.d.ts | 288 ++++ lib/services/cosmosdbManagement/package.json | 7 +- 7 files changed, 1466 insertions(+), 139 deletions(-) create mode 100644 lib/services/cosmosdbManagement/lib/models/errorResponse.js create mode 100644 lib/services/cosmosdbManagement/lib/models/regionForOnlineOffline.js diff --git a/lib/services/cosmosdbManagement/lib/models/errorResponse.js b/lib/services/cosmosdbManagement/lib/models/errorResponse.js new file mode 100644 index 0000000000..32e994231a --- /dev/null +++ b/lib/services/cosmosdbManagement/lib/models/errorResponse.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Error Response. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/cosmosdbManagement/lib/models/index.d.ts b/lib/services/cosmosdbManagement/lib/models/index.d.ts index e9a69fa5b6..e03937ab72 100644 --- a/lib/services/cosmosdbManagement/lib/models/index.d.ts +++ b/lib/services/cosmosdbManagement/lib/models/index.d.ts @@ -204,6 +204,21 @@ export interface DatabaseAccount extends Resource { virtualNetworkRules?: VirtualNetworkRule[]; } +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * Error Response. + * + * @member {string} [code] Error code. + * @member {string} [message] Error message indicating why the operation + * failed. + */ +export interface ErrorResponse { + code?: string; + message?: string; +} + /** * @class * Initializes a new instance of the FailoverPolicies class. @@ -216,6 +231,19 @@ export interface FailoverPolicies { failoverPolicies: FailoverPolicy[]; } +/** + * @class + * Initializes a new instance of the RegionForOnlineOffline class. + * @constructor + * Cosmos DB region to online or offline. + * + * @member {string} region Cosmos DB region, with spaces between words and each + * word capitalized. + */ +export interface RegionForOnlineOffline { + region: string; +} + /** * @class * Initializes a new instance of the DatabaseAccountCreateUpdateParameters class. diff --git a/lib/services/cosmosdbManagement/lib/models/index.js b/lib/services/cosmosdbManagement/lib/models/index.js index 3436075692..5cd558594d 100644 --- a/lib/services/cosmosdbManagement/lib/models/index.js +++ b/lib/services/cosmosdbManagement/lib/models/index.js @@ -25,7 +25,9 @@ exports.FailoverPolicy = require('./failoverPolicy'); exports.VirtualNetworkRule = require('./virtualNetworkRule'); exports.Resource = require('./resource'); exports.DatabaseAccount = require('./databaseAccount'); +exports.ErrorResponse = require('./errorResponse'); exports.FailoverPolicies = require('./failoverPolicies'); +exports.RegionForOnlineOffline = require('./regionForOnlineOffline'); exports.DatabaseAccountCreateUpdateParameters = require('./databaseAccountCreateUpdateParameters'); exports.DatabaseAccountPatchParameters = require('./databaseAccountPatchParameters'); exports.DatabaseAccountListReadOnlyKeysResult = require('./databaseAccountListReadOnlyKeysResult'); diff --git a/lib/services/cosmosdbManagement/lib/models/regionForOnlineOffline.js b/lib/services/cosmosdbManagement/lib/models/regionForOnlineOffline.js new file mode 100644 index 0000000000..fc1055a47e --- /dev/null +++ b/lib/services/cosmosdbManagement/lib/models/regionForOnlineOffline.js @@ -0,0 +1,53 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Cosmos DB region to online or offline. + * + */ +class RegionForOnlineOffline { + /** + * Create a RegionForOnlineOffline. + * @member {string} region Cosmos DB region, with spaces between words and + * each word capitalized. + */ + constructor() { + } + + /** + * Defines the metadata of RegionForOnlineOffline + * + * @returns {object} metadata of RegionForOnlineOffline + * + */ + mapper() { + return { + required: false, + serializedName: 'RegionForOnlineOffline', + type: { + name: 'Composite', + className: 'RegionForOnlineOffline', + modelProperties: { + region: { + required: true, + serializedName: 'region', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RegionForOnlineOffline; diff --git a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js index d1f84412e5..60907651e9 100644 --- a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js +++ b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js @@ -1172,6 +1172,146 @@ function _listConnectionStrings(resourceGroupName, accountName, options, callbac }); } + +/** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _offlineRegion(resourceGroupName, accountName, regionParameterForOffline, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _onlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + /** * Lists the read-only access keys for the specified Azure Cosmos DB database * account. @@ -2844,18 +2984,18 @@ function _beginFailoverPriorityChange(resourceGroupName, accountName, failoverPa } /** - * Regenerates an access key for the specified Azure Cosmos DB database + * Offline the specified region for the specified Azure Cosmos DB database * account. * * @param {string} resourceGroupName Name of an Azure resource group. * * @param {string} accountName Cosmos DB database account name. * - * @param {object} keyToRegenerate The name of the key to regenerate. + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. * - * @param {string} keyToRegenerate.keyKind The access key to regenerate. - * Possible values include: 'primary', 'secondary', 'primaryReadonly', - * 'secondaryReadonly' + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. * * @param {object} [options] Optional Parameters. * @@ -2874,7 +3014,7 @@ function _beginFailoverPriorityChange(resourceGroupName, accountName, failoverPa * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, options, callback) { +function _beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -2922,8 +3062,8 @@ function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, op if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); } - if (keyToRegenerate === null || keyToRegenerate === undefined) { - throw new Error('keyToRegenerate cannot be null or undefined.'); + if (regionParameterForOffline === null || regionParameterForOffline === undefined) { + throw new Error('regionParameterForOffline cannot be null or undefined.'); } if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { throw new Error('this.client.acceptLanguage must be of type string.'); @@ -2934,7 +3074,7 @@ function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, op // Construct URL let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'; requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); @@ -2968,14 +3108,14 @@ function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, op let requestContent = null; let requestModel = null; try { - if (keyToRegenerate !== null && keyToRegenerate !== undefined) { - let requestModelMapper = new client.models['DatabaseAccountRegenerateKeyParameters']().mapper(); - requestModel = client.serialize(requestModelMapper, keyToRegenerate, 'keyToRegenerate'); + if (regionParameterForOffline !== null && regionParameterForOffline !== undefined) { + let requestModelMapper = new client.models['RegionForOnlineOffline']().mapper(); + requestModel = client.serialize(requestModelMapper, regionParameterForOffline, 'regionParameterForOffline'); requestContent = JSON.stringify(requestModel); } } catch (error) { let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + - `payload - ${JSON.stringify(keyToRegenerate, null, 2)}.`); + `payload - ${JSON.stringify(regionParameterForOffline, null, 2)}.`); return callback(serializationError); } httpRequest.body = requestContent; @@ -2995,12 +3135,13 @@ function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, op try { parsedErrorResponse = JSON.parse(responseBody); if (parsedErrorResponse) { - if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; - if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; - if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; } if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3018,86 +3159,441 @@ function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, op }); } -/** Class representing a DatabaseAccounts. */ -class DatabaseAccounts { - /** - * Create a DatabaseAccounts. - * @param {CosmosDBManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._get = _get; - this._patch = _patch; - this._createOrUpdate = _createOrUpdate; - this._deleteMethod = _deleteMethod; - this._failoverPriorityChange = _failoverPriorityChange; - this._list = _list; - this._listByResourceGroup = _listByResourceGroup; - this._listKeys = _listKeys; - this._listConnectionStrings = _listConnectionStrings; - this._listReadOnlyKeys = _listReadOnlyKeys; - this._regenerateKey = _regenerateKey; - this._checkNameExists = _checkNameExists; - this._listMetrics = _listMetrics; - this._listUsages = _listUsages; - this._listMetricDefinitions = _listMetricDefinitions; - this._beginPatch = _beginPatch; - this._beginCreateOrUpdate = _beginCreateOrUpdate; - this._beginDeleteMethod = _beginDeleteMethod; - this._beginFailoverPriorityChange = _beginFailoverPriorityChange; - this._beginRegenerateKey = _beginRegenerateKey; +/** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; } - - /** - * Retrieves the properties of an existing Azure Cosmos DB database account. - * - * @param {string} resourceGroupName Name of an Azure resource group. - * - * @param {string} accountName Cosmos DB database account name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @returns {Promise} A promise is returned - * - * @resolve {HttpOperationResponse} - The deserialized result object. - * - * @reject {Error} - The error object. - */ - getWithHttpOperationResponse(resourceGroupName, accountName, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._get(resourceGroupName, accountName, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); + if (!callback) { + throw new Error('callback cannot be null.'); } - - /** - * Retrieves the properties of an existing Azure Cosmos DB database account. - * - * @param {string} resourceGroupName Name of an Azure resource group. - * - * @param {string} accountName Cosmos DB database account name. - * - * @param {object} [options] Optional Parameters. - * - * @param {object} [options.customHeaders] Headers that will be added to the - * request - * - * @param {function} [optionalCallback] - The optional callback. - * - * @returns {function|Promise} If a callback was passed as the last parameter - * then it returns the callback else returns a Promise. - * - * {Promise} A promise is returned + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (accountName !== null && accountName !== undefined) { + if (accountName.length > 50) + { + throw new Error('"accountName" should satisfy the constraint - "MaxLength": 50'); + } + if (accountName.length < 3) + { + throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (regionParameterForOnline === null || regionParameterForOnline === undefined) { + throw new Error('regionParameterForOnline cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (regionParameterForOnline !== null && regionParameterForOnline !== undefined) { + let requestModelMapper = new client.models['RegionForOnlineOffline']().mapper(); + requestModel = client.serialize(requestModelMapper, regionParameterForOnline, 'regionParameterForOnline'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(regionParameterForOnline, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + let internalError = null; + if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; + error.code = internalError ? internalError.code : parsedErrorResponse.code; + error.message = internalError ? internalError.message : parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['ErrorResponse']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Regenerates an access key for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} keyToRegenerate The name of the key to regenerate. + * + * @param {string} keyToRegenerate.keyKind The access key to regenerate. + * Possible values include: 'primary', 'secondary', 'primaryReadonly', + * 'secondaryReadonly' + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginRegenerateKey(resourceGroupName, accountName, keyToRegenerate, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (accountName !== null && accountName !== undefined) { + if (accountName.length > 50) + { + throw new Error('"accountName" should satisfy the constraint - "MaxLength": 50'); + } + if (accountName.length < 3) + { + throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (keyToRegenerate === null || keyToRegenerate === undefined) { + throw new Error('keyToRegenerate cannot be null or undefined.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (keyToRegenerate !== null && keyToRegenerate !== undefined) { + let requestModelMapper = new client.models['DatabaseAccountRegenerateKeyParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, keyToRegenerate, 'keyToRegenerate'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(keyToRegenerate, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a DatabaseAccounts. */ +class DatabaseAccounts { + /** + * Create a DatabaseAccounts. + * @param {CosmosDBManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._patch = _patch; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._failoverPriorityChange = _failoverPriorityChange; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._listKeys = _listKeys; + this._listConnectionStrings = _listConnectionStrings; + this._offlineRegion = _offlineRegion; + this._onlineRegion = _onlineRegion; + this._listReadOnlyKeys = _listReadOnlyKeys; + this._regenerateKey = _regenerateKey; + this._checkNameExists = _checkNameExists; + this._listMetrics = _listMetrics; + this._listUsages = _listUsages; + this._listMetricDefinitions = _listMetricDefinitions; + this._beginPatch = _beginPatch; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginFailoverPriorityChange = _beginFailoverPriorityChange; + this._beginOfflineRegion = _beginOfflineRegion; + this._beginOnlineRegion = _beginOnlineRegion; + this._beginRegenerateKey = _beginRegenerateKey; + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, accountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, accountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned * * @resolve {DatabaseAccount} - The deserialized result object. * @@ -3673,7 +4169,179 @@ class DatabaseAccounts { * * {Promise} A promise is returned * - * @resolve {DatabaseAccountsListResult} - The deserialized result object. + * @resolve {DatabaseAccountsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAccountsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given + * resource group. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given + * resource group. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseAccountsListResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAccountsListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listKeysWithHttpOperationResponse(resourceGroupName, accountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listKeys(resourceGroupName, accountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseAccountListKeysResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3682,14 +4350,14 @@ class DatabaseAccounts { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseAccountsListResult} for more + * See {@link DatabaseAccountListKeysResult} for more * information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - list(options, optionalCallback) { + listKeys(resourceGroupName, accountName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3698,23 +4366,25 @@ class DatabaseAccounts { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._list(options, (err, result, request, response) => { + self._listKeys(resourceGroupName, accountName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._list(options, optionalCallback); + return self._listKeys(resourceGroupName, accountName, options, optionalCallback); } } /** - * Lists all the Azure Cosmos DB database accounts available under the given - * resource group. + * Lists the connection strings for the specified Azure Cosmos DB database + * account. * * @param {string} resourceGroupName Name of an Azure resource group. * + * @param {string} accountName Cosmos DB database account name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3722,15 +4392,15 @@ class DatabaseAccounts { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + listConnectionStringsWithHttpOperationResponse(resourceGroupName, accountName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._listConnectionStrings(resourceGroupName, accountName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3741,11 +4411,13 @@ class DatabaseAccounts { } /** - * Lists all the Azure Cosmos DB database accounts available under the given - * resource group. + * Lists the connection strings for the specified Azure Cosmos DB database + * account. * * @param {string} resourceGroupName Name of an Azure resource group. * + * @param {string} accountName Cosmos DB database account name. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3758,7 +4430,7 @@ class DatabaseAccounts { * * {Promise} A promise is returned * - * @resolve {DatabaseAccountsListResult} - The deserialized result object. + * @resolve {DatabaseAccountListConnectionStringsResult} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3767,14 +4439,14 @@ class DatabaseAccounts { * {Error} err - The Error object if an error occurred, null otherwise. * * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseAccountsListResult} for more - * information. + * See {@link DatabaseAccountListConnectionStringsResult} + * for more information. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listByResourceGroup(resourceGroupName, options, optionalCallback) { + listConnectionStrings(resourceGroupName, accountName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3783,24 +4455,31 @@ class DatabaseAccounts { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + self._listConnectionStrings(resourceGroupName, accountName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + return self._listConnectionStrings(resourceGroupName, accountName, options, optionalCallback); } } /** - * Lists the access keys for the specified Azure Cosmos DB database account. + * Offline the specified region for the specified Azure Cosmos DB database + * account. * * @param {string} resourceGroupName Name of an Azure resource group. * * @param {string} accountName Cosmos DB database account name. * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3808,15 +4487,15 @@ class DatabaseAccounts { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listKeysWithHttpOperationResponse(resourceGroupName, accountName, options) { + offlineRegionWithHttpOperationResponse(resourceGroupName, accountName, regionParameterForOffline, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listKeys(resourceGroupName, accountName, options, (err, result, request, response) => { + self._offlineRegion(resourceGroupName, accountName, regionParameterForOffline, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3827,12 +4506,19 @@ class DatabaseAccounts { } /** - * Lists the access keys for the specified Azure Cosmos DB database account. + * Offline the specified region for the specified Azure Cosmos DB database + * account. * * @param {string} resourceGroupName Name of an Azure resource group. * * @param {string} accountName Cosmos DB database account name. * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3845,7 +4531,7 @@ class DatabaseAccounts { * * {Promise} A promise is returned * - * @resolve {DatabaseAccountListKeysResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3853,15 +4539,13 @@ class DatabaseAccounts { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseAccountListKeysResult} for more - * information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listKeys(resourceGroupName, accountName, options, optionalCallback) { + offlineRegion(resourceGroupName, accountName, regionParameterForOffline, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3870,25 +4554,31 @@ class DatabaseAccounts { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listKeys(resourceGroupName, accountName, options, (err, result, request, response) => { + self._offlineRegion(resourceGroupName, accountName, regionParameterForOffline, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listKeys(resourceGroupName, accountName, options, optionalCallback); + return self._offlineRegion(resourceGroupName, accountName, regionParameterForOffline, options, optionalCallback); } } /** - * Lists the connection strings for the specified Azure Cosmos DB database + * Online the specified region for the specified Azure Cosmos DB database * account. * * @param {string} resourceGroupName Name of an Azure resource group. * * @param {string} accountName Cosmos DB database account name. * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3896,15 +4586,15 @@ class DatabaseAccounts { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - listConnectionStringsWithHttpOperationResponse(resourceGroupName, accountName, options) { + onlineRegionWithHttpOperationResponse(resourceGroupName, accountName, regionParameterForOnline, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._listConnectionStrings(resourceGroupName, accountName, options, (err, result, request, response) => { + self._onlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -3915,13 +4605,19 @@ class DatabaseAccounts { } /** - * Lists the connection strings for the specified Azure Cosmos DB database + * Online the specified region for the specified Azure Cosmos DB database * account. * * @param {string} resourceGroupName Name of an Azure resource group. * * @param {string} accountName Cosmos DB database account name. * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3934,7 +4630,7 @@ class DatabaseAccounts { * * {Promise} A promise is returned * - * @resolve {DatabaseAccountListConnectionStringsResult} - The deserialized result object. + * @resolve {null} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3942,15 +4638,13 @@ class DatabaseAccounts { * * {Error} err - The Error object if an error occurred, null otherwise. * - * {object} [result] - The deserialized result object if an error did not occur. - * See {@link DatabaseAccountListConnectionStringsResult} - * for more information. + * {null} [result] - The deserialized result object if an error did not occur. * * {object} [request] - The HTTP Request object if an error did not occur. * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listConnectionStrings(resourceGroupName, accountName, options, optionalCallback) { + onlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -3959,14 +4653,14 @@ class DatabaseAccounts { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listConnectionStrings(resourceGroupName, accountName, options, (err, result, request, response) => { + self._onlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._listConnectionStrings(resourceGroupName, accountName, options, optionalCallback); + return self._onlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, optionalCallback); } } @@ -5016,6 +5710,204 @@ class DatabaseAccounts { } } + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginOfflineRegionWithHttpOperationResponse(resourceGroupName, accountName, regionParameterForOffline, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginOfflineRegion(resourceGroupName, accountName, regionParameterForOffline, options, optionalCallback); + } + } + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginOnlineRegionWithHttpOperationResponse(resourceGroupName, accountName, regionParameterForOnline, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginOnlineRegion(resourceGroupName, accountName, regionParameterForOnline, options, optionalCallback); + } + } + /** * Regenerates an access key for the specified Azure Cosmos DB database * account. diff --git a/lib/services/cosmosdbManagement/lib/operations/index.d.ts b/lib/services/cosmosdbManagement/lib/operations/index.d.ts index 1073980bde..e3dc7e98c0 100644 --- a/lib/services/cosmosdbManagement/lib/operations/index.d.ts +++ b/lib/services/cosmosdbManagement/lib/operations/index.d.ts @@ -700,6 +700,150 @@ export interface DatabaseAccounts { listConnectionStrings(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + offlineRegionWithHttpOperationResponse(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + offlineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + offlineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, callback: ServiceCallback): void; + offlineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + onlineRegionWithHttpOperationResponse(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + onlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + onlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, callback: ServiceCallback): void; + onlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Lists the read-only access keys for the specified Azure Cosmos DB database * account. @@ -1476,6 +1620,150 @@ export interface DatabaseAccounts { beginFailoverPriorityChange(resourceGroupName: string, accountName: string, failoverParameters: models.FailoverPolicies, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginOfflineRegionWithHttpOperationResponse(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Offline the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOffline Cosmos DB region to offline for + * the database account. + * + * @param {string} regionParameterForOffline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginOfflineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginOfflineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, callback: ServiceCallback): void; + beginOfflineRegion(resourceGroupName: string, accountName: string, regionParameterForOffline: models.RegionForOnlineOffline, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginOnlineRegionWithHttpOperationResponse(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Online the specified region for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} regionParameterForOnline Cosmos DB region to online for the + * database account. + * + * @param {string} regionParameterForOnline.region Cosmos DB region, with + * spaces between words and each word capitalized. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginOnlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginOnlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, callback: ServiceCallback): void; + beginOnlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Regenerates an access key for the specified Azure Cosmos DB database * account. diff --git a/lib/services/cosmosdbManagement/package.json b/lib/services/cosmosdbManagement/package.json index 92ec1639b8..f72d19dee8 100644 --- a/lib/services/cosmosdbManagement/package.json +++ b/lib/services/cosmosdbManagement/package.json @@ -4,10 +4,13 @@ "description": "CosmosDBManagementClient Library with typescript type definitions for node", "version": "1.1.1-preview", "dependencies": { - "ms-rest": "^2.3.2", + "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" }, - "keywords": [ "node", "azure" ], + "keywords": [ + "node", + "azure" + ], "license": "MIT", "main": "./lib/cosmosDBManagementClient.js", "types": "./lib/cosmosDBManagementClient.d.ts", From aaef0d5f9797cb1160f2dbddd17a3e1c503c4372 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 19 Jun 2018 12:14:42 -0700 Subject: [PATCH 3/4] Generated from 6d9c73eb24e60d117da852b974504d93e47d1a3c (#2996) renaming older operation --- .../lib/operations/databaseAccounts.js | 263 +++++++++++++++++- .../lib/operations/index.d.ts | 62 +++++ 2 files changed, 324 insertions(+), 1 deletion(-) diff --git a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js index 60907651e9..d83daa64d5 100644 --- a/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js +++ b/lib/services/cosmosdbManagement/lib/operations/databaseAccounts.js @@ -1339,7 +1339,7 @@ function _onlineRegion(resourceGroupName, accountName, regionParameterForOnline, * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _listReadOnlyKeys(resourceGroupName, accountName, options, callback) { +function _getReadOnlyKeys(resourceGroupName, accountName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -1483,6 +1483,177 @@ function _listReadOnlyKeys(resourceGroupName, accountName, options, callback) { }); } +/** + * Lists the read-only access keys for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAccountListReadOnlyKeysResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listReadOnlyKeys(resourceGroupName, accountName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (resourceGroupName !== null && resourceGroupName !== undefined) { + if (resourceGroupName.length > 90) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MaxLength": 90'); + } + if (resourceGroupName.length < 1) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "MinLength": 1'); + } + if (resourceGroupName.match(/^[-\w\._\(\)]+$/) === null) + { + throw new Error('"resourceGroupName" should satisfy the constraint - "Pattern": /^[-\w\._\(\)]+$/'); + } + } + if (accountName === null || accountName === undefined || typeof accountName.valueOf() !== 'string') { + throw new Error('accountName cannot be null or undefined and it must be of type string.'); + } + if (accountName !== null && accountName !== undefined) { + if (accountName.length > 50) + { + throw new Error('"accountName" should satisfy the constraint - "MaxLength": 50'); + } + if (accountName.length < 3) + { + throw new Error('"accountName" should satisfy the constraint - "MinLength": 3'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{accountName}', encodeURIComponent(accountName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'POST'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DatabaseAccountListReadOnlyKeysResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + /** * Regenerates an access key for the specified Azure Cosmos DB database @@ -3529,6 +3700,7 @@ class DatabaseAccounts { this._listConnectionStrings = _listConnectionStrings; this._offlineRegion = _offlineRegion; this._onlineRegion = _onlineRegion; + this._getReadOnlyKeys = _getReadOnlyKeys; this._listReadOnlyKeys = _listReadOnlyKeys; this._regenerateKey = _regenerateKey; this._checkNameExists = _checkNameExists; @@ -4664,6 +4836,95 @@ class DatabaseAccounts { } } + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getReadOnlyKeysWithHttpOperationResponse(resourceGroupName, accountName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getReadOnlyKeys(resourceGroupName, accountName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DatabaseAccountListReadOnlyKeysResult} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAccountListReadOnlyKeysResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getReadOnlyKeys(resourceGroupName, accountName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getReadOnlyKeys(resourceGroupName, accountName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getReadOnlyKeys(resourceGroupName, accountName, options, optionalCallback); + } + } + /** * Lists the read-only access keys for the specified Azure Cosmos DB database * account. diff --git a/lib/services/cosmosdbManagement/lib/operations/index.d.ts b/lib/services/cosmosdbManagement/lib/operations/index.d.ts index e3dc7e98c0..1e8ad04246 100644 --- a/lib/services/cosmosdbManagement/lib/operations/index.d.ts +++ b/lib/services/cosmosdbManagement/lib/operations/index.d.ts @@ -844,6 +844,68 @@ export interface DatabaseAccounts { onlineRegion(resourceGroupName: string, accountName: string, regionParameterForOnline: models.RegionForOnlineOffline, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getReadOnlyKeysWithHttpOperationResponse(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database + * account. + * + * @param {string} resourceGroupName Name of an Azure resource group. + * + * @param {string} accountName Cosmos DB database account name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DatabaseAccountListReadOnlyKeysResult} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {DatabaseAccountListReadOnlyKeysResult} [result] - The deserialized result object if an error did not occur. + * See {@link DatabaseAccountListReadOnlyKeysResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getReadOnlyKeys(resourceGroupName: string, accountName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getReadOnlyKeys(resourceGroupName: string, accountName: string, callback: ServiceCallback): void; + getReadOnlyKeys(resourceGroupName: string, accountName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Lists the read-only access keys for the specified Azure Cosmos DB database * account. From 7ad4454d2d7e92e726e982c922552881bfa576fd Mon Sep 17 00:00:00 2001 From: Dan Schulte Date: Thu, 26 Jul 2018 11:56:49 -0700 Subject: [PATCH 4/4] Regenerate azure-arm-cosmosdb --- .../lib/cosmosDBManagementClient.d.ts | 6 +- .../lib/cosmosDBManagementClient.js | 6 +- .../cosmosdbManagement/package-lock.json | 473 ++++++++++++++++++ lib/services/cosmosdbManagement/package.json | 6 +- 4 files changed, 482 insertions(+), 9 deletions(-) create mode 100644 lib/services/cosmosdbManagement/package-lock.json diff --git a/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.d.ts b/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.d.ts index fa38c8fcfd..84a17eaa07 100644 --- a/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.d.ts +++ b/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.d.ts @@ -34,11 +34,11 @@ export default class CosmosDBManagementClient extends AzureServiceClient { * * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy * - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {string} [options.acceptLanguage] - The preferred language for the response. * - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. * - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. * */ constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); diff --git a/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.js b/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.js index cdecaec4e3..06764dc32c 100644 --- a/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.js +++ b/lib/services/cosmosdbManagement/lib/cosmosDBManagementClient.js @@ -34,9 +34,9 @@ class CosmosDBManagementClient extends ServiceClient { * @param {object} [options.requestOptions] - Options for the underlying request object * {@link https://github.com/request/request#requestoptions-callback Options doc} * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy - * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. - * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. - * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * @param {string} [options.acceptLanguage] - The preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - The retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ constructor(credentials, subscriptionId, baseUri, options) { if (credentials === null || credentials === undefined) { diff --git a/lib/services/cosmosdbManagement/package-lock.json b/lib/services/cosmosdbManagement/package-lock.json new file mode 100644 index 0000000000..278f10f4f2 --- /dev/null +++ b/lib/services/cosmosdbManagement/package-lock.json @@ -0,0 +1,473 @@ +{ + "name": "azure-arm-cosmosdb", + "version": "2.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "8.10.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.21.tgz", + "integrity": "sha512-87XkD9qDXm8fIax+5y7drx84cXsu34ZZqfB7Cial3Q/2lxSoJ/+DRaWckkCbxP41wFSIrrb939VhzaNxj4eY1w==" + }, + "adal-node": { + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/adal-node/-/adal-node-0.1.28.tgz", + "integrity": "sha1-RoxLs+u9lrEnBmn0ucuk4AZepIU=", + "requires": { + "@types/node": "^8.0.47", + "async": ">=0.6.0", + "date-utils": "*", + "jws": "3.x.x", + "request": ">= 2.52.0", + "underscore": ">= 1.3.1", + "uuid": "^3.1.0", + "xmldom": ">= 0.1.x", + "xpath.js": "~1.1.0" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", + "integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", + "requires": { + "lodash": "^4.14.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==" + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "date-utils": { + "version": "1.2.21", + "resolved": "https://registry.npmjs.org/date-utils/-/date-utils-1.2.21.tgz", + "integrity": "sha1-YfsWzcEnSzyayq/+n8ad+HIKK2Q=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ecdsa-sig-formatter": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz", + "integrity": "sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "jwa": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.1.6.tgz", + "integrity": "sha512-tBO/cf++BUsJkYql/kBbJroKOgHWEigTKBAjjBEmrMGYd1QMBC74Hr4Wo2zCZw6ZrVhlJPvoMrkcOnlWR/DJfw==", + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.10", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.1.5.tgz", + "integrity": "sha512-GsCSexFADNQUr8T5HPJvayTjvPIfoyJPtLQBwn5a4WZQchcrPMPMAWcC1AzJVRDKyD6ZPROPAxgv6rfHViO4uQ==", + "requires": { + "jwa": "^1.1.5", + "safe-buffer": "^5.0.1" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" + }, + "mime-db": { + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==" + }, + "mime-types": { + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", + "requires": { + "mime-db": "~1.35.0" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=" + }, + "ms-rest": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/ms-rest/-/ms-rest-2.3.6.tgz", + "integrity": "sha512-M+Lx9P7Wy4TeAk7jqPLwGS1QS1gvxF6Xo+OHv5j1g3Kcb44T/GTUuSjxTKarF6aKyeacZH1ZD++Nt7pcql7dDA==", + "requires": { + "duplexer": "^0.1.1", + "is-buffer": "^1.1.6", + "is-stream": "^1.1.0", + "moment": "^2.21.0", + "request": "^2.87.0", + "through": "^2.3.8", + "tunnel": "0.0.5", + "uuid": "^3.2.1" + } + }, + "ms-rest-azure": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/ms-rest-azure/-/ms-rest-azure-2.5.7.tgz", + "integrity": "sha512-e4lgB0z29Dx4ufu/c+PmEAYY1WXq98GYUBkE+iRx7WsxsN04lrM3B1vj8y+B8rKt7clPUE0niqB9VovVL8zvag==", + "requires": { + "adal-node": "^0.1.28", + "async": "2.6.0", + "moment": "^2.22.2", + "ms-rest": "^2.3.2", + "uuid": "^3.2.1" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "request": { + "version": "2.87.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz", + "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "^1.4.1" + } + }, + "tunnel": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.5.tgz", + "integrity": "sha512-gj5sdqherx4VZKMcBA4vewER7zdK25Td+z1npBqpbDys4eJrLx+SlYjJvq1bDXs2irkuJM5pf8ktaEQVipkrbA==" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "xmldom": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/xmldom/-/xmldom-0.1.27.tgz", + "integrity": "sha1-1QH5ezvbQDr4757MIFcxh6rawOk=" + }, + "xpath.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xpath.js/-/xpath.js-1.1.0.tgz", + "integrity": "sha512-jg+qkfS4K8E7965sqaUl8mRngXiKb3WZGfONgE18pr03FUQiuSV6G+Ej4tS55B+rIQSFEIw3phdVAQ4pPqNWfQ==" + } + } +} diff --git a/lib/services/cosmosdbManagement/package.json b/lib/services/cosmosdbManagement/package.json index f72d19dee8..2e92d54dae 100644 --- a/lib/services/cosmosdbManagement/package.json +++ b/lib/services/cosmosdbManagement/package.json @@ -2,7 +2,7 @@ "name": "azure-arm-cosmosdb", "author": "Microsoft Corporation", "description": "CosmosDBManagementClient Library with typescript type definitions for node", - "version": "1.1.1-preview", + "version": "2.0.0", "dependencies": { "ms-rest": "^2.3.3", "ms-rest-azure": "^2.5.5" @@ -14,12 +14,12 @@ "license": "MIT", "main": "./lib/cosmosDBManagementClient.js", "types": "./lib/cosmosDBManagementClient.d.ts", - "homepage": "http://github.com/azure/azure-sdk-for-node", + "homepage": "https://github.com/azure/azure-sdk-for-node/lib/services/cosmosdbManagement", "repository": { "type": "git", "url": "https://github.com/azure/azure-sdk-for-node.git" }, "bugs": { - "url": "http://github.com/Azure/azure-sdk-for-node/issues" + "url": "https://github.com/azure/azure-sdk-for-node/issues" } }