Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

[AutoPR cosmos-db/resource-manager] Add VNet related properties to CosmosDB #2671

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions lib/services/cosmosdbManagement/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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.
84 changes: 42 additions & 42 deletions lib/services/cosmosdbManagement/README.md
Original file line number Diff line number Diff line change
@@ -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 = "<Subscription_Id>";
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 = "<Subscription_Id>";
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)
26 changes: 26 additions & 0 deletions lib/services/cosmosdbManagement/lib/models/databaseAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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'
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,17 @@ 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
* 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.
*/
constructor() {
super();
Expand Down Expand Up @@ -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',
Expand All @@ -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'
}
}
}
}
}
}
Expand Down
25 changes: 25 additions & 0 deletions lib/services/cosmosdbManagement/lib/models/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -170,19 +185,23 @@ 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;
provisioningState?: string;
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[];
}

/**
Expand Down Expand Up @@ -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[];
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/services/cosmosdbManagement/lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
53 changes: 53 additions & 0 deletions lib/services/cosmosdbManagement/lib/models/virtualNetworkRule.js
Original file line number Diff line number Diff line change
@@ -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;
Loading