From 3e1a02f08c8666ef91ff879be96a3e9742ae6847 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 21 Jun 2018 16:04:18 -0700 Subject: [PATCH] [AutoPR network/resource-manager] Release of Azure Networking Network-2018-06-01 (api-version 2018-04-01) (#3028) * Generated from e15c8600ed6dbd8440f2471838554034175c4c07 Integrated recent changes into 2018-04-01 * Generated from ca313b2e8484a0dca375caa8d71a581f6a0e4353 moved fixes in Vnet gateway to april branch * Generated from 05c228ff1cea5f29c0748791f907a63d3a347b4e reverted nic vm as readonly * Generated from f3195c8e637274e6bc1ffe14dc891c101c923c7f Adding VirtualWan Swagger (#3204) * Adding VirtualWan Swagger * Adding the CRUD Apis for VpnConnections * Updating VpnGateway examples * Fixing build errors * Addressing comments * Addressing comments and editing VpnConnection definition and corresponding examples * Addressing comments * Removing enableRateLimiting property * Addressing comments * Changing the version to 2018-04-01 version --- .../lib/models/applicationGateway.js | 43 +- .../applicationGatewayAutoscaleBounds.js | 63 + ...pplicationGatewayAutoscaleConfiguration.js | 59 + .../lib/models/applicationGatewaySku.js | 4 +- .../lib/models/connectionSharedKey.js | 13 +- .../lib/models/deviceProperties.js | 68 + .../models/getVpnSitesConfigurationRequest.js | 72 + .../lib/models/hubVirtualNetworkConnection.js | 141 + .../networkManagement2/lib/models/index.d.ts | 385 +- .../networkManagement2/lib/models/index.js | 18 + .../listHubVirtualNetworkConnectionsResult.js | 69 + .../lib/models/listVirtualHubsResult.js | 69 + .../lib/models/listVirtualWANsResult.js | 69 + .../lib/models/listVpnConnectionsResult.js | 70 + .../lib/models/listVpnGatewaysResult.js | 69 + .../lib/models/listVpnSitesResult.js | 69 + .../networkManagement2/lib/models/policies.js | 62 + .../lib/models/virtualHub.js | 148 + .../lib/models/virtualWAN.js | 155 + .../lib/models/vpnConnection.js | 199 + .../lib/models/vpnGateway.js | 166 + .../networkManagement2/lib/models/vpnSite.js | 178 + .../lib/models/vpnSiteId.js | 54 + .../lib/networkManagementClient.d.ts | 7 + .../lib/networkManagementClient.js | 7 + .../lib/operations/applicationGateways.js | 120 +- .../operations/expressRouteCircuitPeerings.js | 6 +- .../hubVirtualNetworkConnections.js | 720 +++ .../lib/operations/index.d.ts | 4252 ++++++++++++++++- .../lib/operations/index.js | 7 + .../lib/operations/virtualHubs.js | 2519 ++++++++++ .../virtualNetworkGatewayConnections.js | 40 +- .../lib/operations/virtualWANs.js | 2471 ++++++++++ .../lib/operations/vpnConnections.js | 1735 +++++++ .../lib/operations/vpnGateways.js | 2627 ++++++++++ .../lib/operations/vpnSites.js | 2687 +++++++++++ .../lib/operations/vpnSitesConfiguration.js | 473 ++ 37 files changed, 19847 insertions(+), 67 deletions(-) create mode 100644 lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleBounds.js create mode 100644 lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleConfiguration.js create mode 100644 lib/services/networkManagement2/lib/models/deviceProperties.js create mode 100644 lib/services/networkManagement2/lib/models/getVpnSitesConfigurationRequest.js create mode 100644 lib/services/networkManagement2/lib/models/hubVirtualNetworkConnection.js create mode 100644 lib/services/networkManagement2/lib/models/listHubVirtualNetworkConnectionsResult.js create mode 100644 lib/services/networkManagement2/lib/models/listVirtualHubsResult.js create mode 100644 lib/services/networkManagement2/lib/models/listVirtualWANsResult.js create mode 100644 lib/services/networkManagement2/lib/models/listVpnConnectionsResult.js create mode 100644 lib/services/networkManagement2/lib/models/listVpnGatewaysResult.js create mode 100644 lib/services/networkManagement2/lib/models/listVpnSitesResult.js create mode 100644 lib/services/networkManagement2/lib/models/policies.js create mode 100644 lib/services/networkManagement2/lib/models/virtualHub.js create mode 100644 lib/services/networkManagement2/lib/models/virtualWAN.js create mode 100644 lib/services/networkManagement2/lib/models/vpnConnection.js create mode 100644 lib/services/networkManagement2/lib/models/vpnGateway.js create mode 100644 lib/services/networkManagement2/lib/models/vpnSite.js create mode 100644 lib/services/networkManagement2/lib/models/vpnSiteId.js create mode 100644 lib/services/networkManagement2/lib/operations/hubVirtualNetworkConnections.js create mode 100644 lib/services/networkManagement2/lib/operations/virtualHubs.js create mode 100644 lib/services/networkManagement2/lib/operations/virtualWANs.js create mode 100644 lib/services/networkManagement2/lib/operations/vpnConnections.js create mode 100644 lib/services/networkManagement2/lib/operations/vpnGateways.js create mode 100644 lib/services/networkManagement2/lib/operations/vpnSites.js create mode 100644 lib/services/networkManagement2/lib/operations/vpnSitesConfiguration.js diff --git a/lib/services/networkManagement2/lib/models/applicationGateway.js b/lib/services/networkManagement2/lib/models/applicationGateway.js index 47ddea3f90..e6578da902 100644 --- a/lib/services/networkManagement2/lib/models/applicationGateway.js +++ b/lib/services/networkManagement2/lib/models/applicationGateway.js @@ -23,9 +23,9 @@ class ApplicationGateway extends models['Resource'] { * @member {object} [sku] SKU of the application gateway resource. * @member {string} [sku.name] Name of an application gateway SKU. Possible * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', - * 'WAF_Medium', 'WAF_Large' + * 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * @member {string} [sku.tier] Tier of an application gateway. Possible - * values include: 'Standard', 'WAF' + * values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * @member {number} [sku.capacity] Capacity (instance count) of an * application gateway. * @member {object} [sslPolicy] SSL policy of the application gateway @@ -88,6 +88,14 @@ class ApplicationGateway extends models['Resource'] { * Maxium request body size for WAF. * @member {boolean} [enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. + * @member {boolean} [enableFips] Whether FIPS is enabled on the application + * gateway resource. + * @member {object} [autoscaleConfiguration] Autoscale Configuration. + * @member {object} [autoscaleConfiguration.bounds] Autoscale bounds + * @member {number} [autoscaleConfiguration.bounds.min] Lower bound on number + * of Application Gateway instances. + * @member {number} [autoscaleConfiguration.bounds.max] Upper bound on number + * of Application Gateway instances. * @member {string} [resourceGuid] Resource GUID property of the application * gateway resource. * @member {string} [provisioningState] Provisioning state of the application @@ -95,6 +103,8 @@ class ApplicationGateway extends models['Resource'] { * 'Failed'. * @member {string} [etag] A unique read-only string that changes whenever * the resource is updated. + * @member {array} [zones] A list of availability zones denoting where the + * resource needs to come from. */ constructor() { super(); @@ -377,6 +387,21 @@ class ApplicationGateway extends models['Resource'] { name: 'Boolean' } }, + enableFips: { + required: false, + serializedName: 'properties.enableFips', + type: { + name: 'Boolean' + } + }, + autoscaleConfiguration: { + required: false, + serializedName: 'properties.autoscaleConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayAutoscaleConfiguration' + } + }, resourceGuid: { required: false, serializedName: 'properties.resourceGuid', @@ -397,6 +422,20 @@ class ApplicationGateway extends models['Resource'] { type: { name: 'String' } + }, + zones: { + required: false, + serializedName: 'zones', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } } } } diff --git a/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleBounds.js b/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleBounds.js new file mode 100644 index 0000000000..65931cdbf8 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleBounds.js @@ -0,0 +1,63 @@ +/* + * 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'; + +/** + * Application Gateway autoscale bounds on number of Application Gateway + * instance. + * + */ +class ApplicationGatewayAutoscaleBounds { + /** + * Create a ApplicationGatewayAutoscaleBounds. + * @member {number} min Lower bound on number of Application Gateway + * instances. + * @member {number} max Upper bound on number of Application Gateway + * instances. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayAutoscaleBounds + * + * @returns {object} metadata of ApplicationGatewayAutoscaleBounds + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAutoscaleBounds', + type: { + name: 'Composite', + className: 'ApplicationGatewayAutoscaleBounds', + modelProperties: { + min: { + required: true, + serializedName: 'min', + type: { + name: 'Number' + } + }, + max: { + required: true, + serializedName: 'max', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAutoscaleBounds; diff --git a/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleConfiguration.js b/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleConfiguration.js new file mode 100644 index 0000000000..1cdf898a49 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/applicationGatewayAutoscaleConfiguration.js @@ -0,0 +1,59 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * Application Gateway autoscale configuration. + * + */ +class ApplicationGatewayAutoscaleConfiguration { + /** + * Create a ApplicationGatewayAutoscaleConfiguration. + * @member {object} bounds Autoscale bounds + * @member {number} [bounds.min] Lower bound on number of Application Gateway + * instances. + * @member {number} [bounds.max] Upper bound on number of Application Gateway + * instances. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayAutoscaleConfiguration + * + * @returns {object} metadata of ApplicationGatewayAutoscaleConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAutoscaleConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayAutoscaleConfiguration', + modelProperties: { + bounds: { + required: true, + serializedName: 'bounds', + type: { + name: 'Composite', + className: 'ApplicationGatewayAutoscaleBounds' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAutoscaleConfiguration; diff --git a/lib/services/networkManagement2/lib/models/applicationGatewaySku.js b/lib/services/networkManagement2/lib/models/applicationGatewaySku.js index 2bf5af52f6..7e76996b52 100644 --- a/lib/services/networkManagement2/lib/models/applicationGatewaySku.js +++ b/lib/services/networkManagement2/lib/models/applicationGatewaySku.js @@ -19,9 +19,9 @@ class ApplicationGatewaySku { * Create a ApplicationGatewaySku. * @member {string} [name] Name of an application gateway SKU. Possible * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', - * 'WAF_Medium', 'WAF_Large' + * 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * @member {string} [tier] Tier of an application gateway. Possible values - * include: 'Standard', 'WAF' + * include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * @member {number} [capacity] Capacity (instance count) of an application * gateway. */ diff --git a/lib/services/networkManagement2/lib/models/connectionSharedKey.js b/lib/services/networkManagement2/lib/models/connectionSharedKey.js index a74b9eeeca..ad71412918 100644 --- a/lib/services/networkManagement2/lib/models/connectionSharedKey.js +++ b/lib/services/networkManagement2/lib/models/connectionSharedKey.js @@ -10,16 +10,20 @@ 'use strict'; +const models = require('./index'); + /** * Response for GetConnectionSharedKey API service call * + * @extends models['SubResource'] */ -class ConnectionSharedKey { +class ConnectionSharedKey extends models['SubResource'] { /** * Create a ConnectionSharedKey. * @member {string} value The virtual network connection shared key value. */ constructor() { + super(); } /** @@ -36,6 +40,13 @@ class ConnectionSharedKey { name: 'Composite', className: 'ConnectionSharedKey', modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, value: { required: true, serializedName: 'value', diff --git a/lib/services/networkManagement2/lib/models/deviceProperties.js b/lib/services/networkManagement2/lib/models/deviceProperties.js new file mode 100644 index 0000000000..c9652c5cd9 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/deviceProperties.js @@ -0,0 +1,68 @@ +/* + * 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'; + +/** + * List of properties of the device. + * + */ +class DeviceProperties { + /** + * Create a DeviceProperties. + * @member {string} [deviceVendor] Name of the device Vendor. + * @member {string} [deviceModel] Model of the device. + * @member {number} [linkSpeedInMbps] Link speed. + */ + constructor() { + } + + /** + * Defines the metadata of DeviceProperties + * + * @returns {object} metadata of DeviceProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'DeviceProperties', + type: { + name: 'Composite', + className: 'DeviceProperties', + modelProperties: { + deviceVendor: { + required: false, + serializedName: 'deviceVendor', + type: { + name: 'String' + } + }, + deviceModel: { + required: false, + serializedName: 'deviceModel', + type: { + name: 'String' + } + }, + linkSpeedInMbps: { + required: false, + serializedName: 'linkSpeedInMbps', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = DeviceProperties; diff --git a/lib/services/networkManagement2/lib/models/getVpnSitesConfigurationRequest.js b/lib/services/networkManagement2/lib/models/getVpnSitesConfigurationRequest.js new file mode 100644 index 0000000000..43fd740986 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/getVpnSitesConfigurationRequest.js @@ -0,0 +1,72 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * List of Vpn-Sites + * + */ +class GetVpnSitesConfigurationRequest { + /** + * Create a GetVpnSitesConfigurationRequest. + * @member {array} [vpnSites] List of resource-ids of the vpn-sites for which + * config is to be downloaded. + * @member {string} [outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + */ + constructor() { + } + + /** + * Defines the metadata of GetVpnSitesConfigurationRequest + * + * @returns {object} metadata of GetVpnSitesConfigurationRequest + * + */ + mapper() { + return { + required: false, + serializedName: 'GetVpnSitesConfigurationRequest', + type: { + name: 'Composite', + className: 'GetVpnSitesConfigurationRequest', + modelProperties: { + vpnSites: { + required: false, + serializedName: 'vpnSites', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + outputBlobSasUrl: { + required: false, + serializedName: 'outputBlobSasUrl', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = GetVpnSitesConfigurationRequest; diff --git a/lib/services/networkManagement2/lib/models/hubVirtualNetworkConnection.js b/lib/services/networkManagement2/lib/models/hubVirtualNetworkConnection.js new file mode 100644 index 0000000000..b534f34173 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/hubVirtualNetworkConnection.js @@ -0,0 +1,141 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * HubVirtualNetworkConnection Resource. + * + * @extends models['Resource'] + */ +class HubVirtualNetworkConnection extends models['Resource'] { + /** + * Create a HubVirtualNetworkConnection. + * @member {object} [remoteVirtualNetwork] Reference to the remote virtual + * network. + * @member {string} [remoteVirtualNetwork.id] Resource ID. + * @member {boolean} [allowHubToRemoteVnetTransit] VirtualHub to RemoteVnet + * transit to enabled or not. + * @member {boolean} [allowRemoteVnetToUseHubVnetGateways] Allow RemoteVnet + * to use Virtual Hub's gateways. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of HubVirtualNetworkConnection + * + * @returns {object} metadata of HubVirtualNetworkConnection + * + */ + mapper() { + return { + required: false, + serializedName: 'HubVirtualNetworkConnection', + type: { + name: 'Composite', + className: 'HubVirtualNetworkConnection', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + remoteVirtualNetwork: { + required: false, + serializedName: 'properties.remoteVirtualNetwork', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + allowHubToRemoteVnetTransit: { + required: false, + serializedName: 'properties.allowHubToRemoteVnetTransit', + type: { + name: 'Boolean' + } + }, + allowRemoteVnetToUseHubVnetGateways: { + required: false, + serializedName: 'properties.allowRemoteVnetToUseHubVnetGateways', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = HubVirtualNetworkConnection; diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index ee5611f4a9..219786f736 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -1703,9 +1703,9 @@ export interface ApplicationGatewayBackendHealth { * * @member {string} [name] Name of an application gateway SKU. Possible values * include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', - * 'WAF_Medium', 'WAF_Large' + * 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * @member {string} [tier] Tier of an application gateway. Possible values - * include: 'Standard', 'WAF' + * include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * @member {number} [capacity] Capacity (instance count) of an application * gateway. */ @@ -2194,6 +2194,37 @@ export interface ApplicationGatewayWebApplicationFirewallConfiguration { maxRequestBodySize?: number; } +/** + * @class + * Initializes a new instance of the ApplicationGatewayAutoscaleBounds class. + * @constructor + * Application Gateway autoscale bounds on number of Application Gateway + * instance. + * + * @member {number} min Lower bound on number of Application Gateway instances. + * @member {number} max Upper bound on number of Application Gateway instances. + */ +export interface ApplicationGatewayAutoscaleBounds { + min: number; + max: number; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayAutoscaleConfiguration class. + * @constructor + * Application Gateway autoscale configuration. + * + * @member {object} bounds Autoscale bounds + * @member {number} [bounds.min] Lower bound on number of Application Gateway + * instances. + * @member {number} [bounds.max] Upper bound on number of Application Gateway + * instances. + */ +export interface ApplicationGatewayAutoscaleConfiguration { + bounds: ApplicationGatewayAutoscaleBounds; +} + /** * @class * Initializes a new instance of the ApplicationGateway class. @@ -2203,9 +2234,9 @@ export interface ApplicationGatewayWebApplicationFirewallConfiguration { * @member {object} [sku] SKU of the application gateway resource. * @member {string} [sku.name] Name of an application gateway SKU. Possible * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', - * 'WAF_Medium', 'WAF_Large' + * 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * @member {string} [sku.tier] Tier of an application gateway. Possible values - * include: 'Standard', 'WAF' + * include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * @member {number} [sku.capacity] Capacity (instance count) of an application * gateway. * @member {object} [sslPolicy] SSL policy of the application gateway resource. @@ -2266,12 +2297,22 @@ export interface ApplicationGatewayWebApplicationFirewallConfiguration { * Maxium request body size for WAF. * @member {boolean} [enableHttp2] Whether HTTP2 is enabled on the application * gateway resource. + * @member {boolean} [enableFips] Whether FIPS is enabled on the application + * gateway resource. + * @member {object} [autoscaleConfiguration] Autoscale Configuration. + * @member {object} [autoscaleConfiguration.bounds] Autoscale bounds + * @member {number} [autoscaleConfiguration.bounds.min] Lower bound on number + * of Application Gateway instances. + * @member {number} [autoscaleConfiguration.bounds.max] Upper bound on number + * of Application Gateway instances. * @member {string} [resourceGuid] Resource GUID property of the application * gateway resource. * @member {string} [provisioningState] Provisioning state of the application * gateway resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * @member {string} [etag] A unique read-only string that changes whenever the * resource is updated. + * @member {array} [zones] A list of availability zones denoting where the + * resource needs to come from. */ export interface ApplicationGateway extends Resource { sku?: ApplicationGatewaySku; @@ -2291,9 +2332,12 @@ export interface ApplicationGateway extends Resource { redirectConfigurations?: ApplicationGatewayRedirectConfiguration[]; webApplicationFirewallConfiguration?: ApplicationGatewayWebApplicationFirewallConfiguration; enableHttp2?: boolean; + enableFips?: boolean; + autoscaleConfiguration?: ApplicationGatewayAutoscaleConfiguration; resourceGuid?: string; provisioningState?: string; etag?: string; + zones?: string[]; } /** @@ -6289,7 +6333,7 @@ export interface ConnectionResetSharedKey { * * @member {string} value The virtual network connection shared key value. */ -export interface ConnectionSharedKey { +export interface ConnectionSharedKey extends SubResource { value: string; } @@ -6432,6 +6476,252 @@ export interface VpnDeviceScriptParameters { firmwareVersion?: string; } +/** + * @class + * Initializes a new instance of the VirtualWAN class. + * @constructor + * VirtualWAN Resource. + * + * @member {boolean} [disableVpnEncryption] Vpn encryption to be disabled or + * not. + * @member {array} [virtualHubs] List of VirtualHubs in the VirtualWAN. + * @member {array} [vpnSites] + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualWAN extends Resource { + disableVpnEncryption?: boolean; + readonly virtualHubs?: SubResource[]; + readonly vpnSites?: SubResource[]; + provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the DeviceProperties class. + * @constructor + * List of properties of the device. + * + * @member {string} [deviceVendor] Name of the device Vendor. + * @member {string} [deviceModel] Model of the device. + * @member {number} [linkSpeedInMbps] Link speed. + */ +export interface DeviceProperties { + deviceVendor?: string; + deviceModel?: string; + linkSpeedInMbps?: number; +} + +/** + * @class + * Initializes a new instance of the VpnSite class. + * @constructor + * VpnSite Resource. + * + * @member {object} [virtualWAN] The VirtualWAN to which the vpnSite belongs + * @member {string} [virtualWAN.id] Resource ID. + * @member {object} [deviceProperties] The device properties + * @member {string} [deviceProperties.deviceVendor] Name of the device Vendor. + * @member {string} [deviceProperties.deviceModel] Model of the device. + * @member {number} [deviceProperties.linkSpeedInMbps] Link speed. + * @member {string} [ipAddress] The ip-address for the vpn-site. + * @member {string} [siteKey] The key for vpn-site that can be used for + * connections. + * @member {object} [addressSpace] The AddressSpace that contains an array of + * IP address ranges. + * @member {array} [addressSpace.addressPrefixes] A list of address blocks + * reserved for this virtual network in CIDR notation. + * @member {object} [bgpProperties] The set of bgp properties. + * @member {number} [bgpProperties.asn] The BGP speaker's ASN. + * @member {string} [bgpProperties.bgpPeeringAddress] The BGP peering address + * and BGP identifier of this BGP speaker. + * @member {number} [bgpProperties.peerWeight] The weight added to routes + * learned from this BGP speaker. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VpnSite extends Resource { + virtualWAN?: SubResource; + deviceProperties?: DeviceProperties; + ipAddress?: string; + siteKey?: string; + addressSpace?: AddressSpace; + bgpProperties?: BgpSettings; + provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the GetVpnSitesConfigurationRequest class. + * @constructor + * List of Vpn-Sites + * + * @member {array} [vpnSites] List of resource-ids of the vpn-sites for which + * config is to be downloaded. + * @member {string} [outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + */ +export interface GetVpnSitesConfigurationRequest { + vpnSites?: SubResource[]; + outputBlobSasUrl?: string; +} + +/** + * @class + * Initializes a new instance of the HubVirtualNetworkConnection class. + * @constructor + * HubVirtualNetworkConnection Resource. + * + * @member {object} [remoteVirtualNetwork] Reference to the remote virtual + * network. + * @member {string} [remoteVirtualNetwork.id] Resource ID. + * @member {boolean} [allowHubToRemoteVnetTransit] VirtualHub to RemoteVnet + * transit to enabled or not. + * @member {boolean} [allowRemoteVnetToUseHubVnetGateways] Allow RemoteVnet to + * use Virtual Hub's gateways. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface HubVirtualNetworkConnection extends Resource { + remoteVirtualNetwork?: SubResource; + allowHubToRemoteVnetTransit?: boolean; + allowRemoteVnetToUseHubVnetGateways?: boolean; + provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualHub class. + * @constructor + * VirtualHub Resource. + * + * @member {object} [virtualWan] The VirtualWAN to which the VirtualHub belongs + * @member {string} [virtualWan.id] Resource ID. + * @member {array} [hubVirtualNetworkConnections] list of all vnet connections + * with this VirtualHub. + * @member {string} [addressPrefix] Address-prefix for this VirtualHub. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualHub extends Resource { + virtualWan?: SubResource; + hubVirtualNetworkConnections?: HubVirtualNetworkConnection[]; + addressPrefix?: string; + provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the VpnConnection class. + * @constructor + * VpnConnection Resource. + * + * @member {object} [remoteVpnSite] Id of the connected vpn site. + * @member {string} [remoteVpnSite.id] Resource ID. + * @member {number} [routingWeight] routing weight for vpn connection. + * @member {string} [connectionStatus] The connection status. Possible values + * include: 'Unknown', 'Connecting', 'Connected', 'NotConnected' + * @member {number} [ingressBytesTransferred] Ingress bytes transferred. + * @member {number} [egressBytesTransferred] Egress bytes transferred. + * @member {number} [connectionBandwidthInMbps] Expected bandwidth in MBPS. + * @member {string} [sharedKey] SharedKey for the vpn connection. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by this + * connection. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VpnConnection extends Resource { + remoteVpnSite?: SubResource; + routingWeight?: number; + connectionStatus?: string; + readonly ingressBytesTransferred?: number; + readonly egressBytesTransferred?: number; + readonly connectionBandwidthInMbps?: number; + sharedKey?: string; + enableBgp?: boolean; + ipsecPolicies?: IpsecPolicy[]; + provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the Policies class. + * @constructor + * Policies for vpn gateway. + * + * @member {boolean} [allowBranchToBranchTraffic] True if branch to branch + * traffic is allowed. + * @member {boolean} [allowVnetToVnetTraffic] True if Vnet to Vnet traffic is + * allowed. + */ +export interface Policies { + allowBranchToBranchTraffic?: boolean; + allowVnetToVnetTraffic?: boolean; +} + +/** + * @class + * Initializes a new instance of the VpnGateway class. + * @constructor + * VpnGateway Resource. + * + * @member {object} [virtualHub] The VirtualHub to which the gateway belongs + * @member {string} [virtualHub.id] Resource ID. + * @member {array} [connections] list of all vpn connections to the gateway. + * @member {object} [bgpSettings] Local network gateway's BGP speaker settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address and + * BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes learned + * from this BGP speaker. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + * @member {object} [policies] The policies applied to this vpn gateway. + * @member {boolean} [policies.allowBranchToBranchTraffic] True if branch to + * branch traffic is allowed. + * @member {boolean} [policies.allowVnetToVnetTraffic] True if Vnet to Vnet + * traffic is allowed. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VpnGateway extends Resource { + virtualHub?: SubResource; + connections?: VpnConnection[]; + bgpSettings?: BgpSettings; + provisioningState?: string; + policies?: Policies; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the VpnSiteId class. + * @constructor + * VpnSite Resource. + * + * @member {string} [vpnSite] The resource-uri of the vpn-site for which config + * is to be fetched. + */ +export interface VpnSiteId { + readonly vpnSite?: string; +} + /** * @class @@ -6926,3 +7216,88 @@ export interface VirtualNetworkGatewayConnectionListResult extends Array { readonly nextLink?: string; } + +/** + * @class + * Initializes a new instance of the ListVirtualWANsResult class. + * @constructor + * Result of the request to list VirtualWANs. It contains a list of VirtualWANs + * and a URL nextLink to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListVirtualWANsResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ListVpnSitesResult class. + * @constructor + * Result of the request to list VpnSites. It contains a list of VpnSites and a + * URL nextLink to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListVpnSitesResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ListVirtualHubsResult class. + * @constructor + * Result of the request to list VirtualHubs. It contains a list of VirtualHubs + * and a URL nextLink to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListVirtualHubsResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ListHubVirtualNetworkConnectionsResult class. + * @constructor + * List of HubVirtualNetworkConnections and a URL nextLink to get the next set + * of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListHubVirtualNetworkConnectionsResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ListVpnGatewaysResult class. + * @constructor + * Result of the request to list VpnGateways. It contains a list of VpnGateways + * and a URL nextLink to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListVpnGatewaysResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ListVpnConnectionsResult class. + * @constructor + * Result of the request to list all vpn connections to a virtual wan vpn + * gateway. It contains a list of Vpn Connections and a URL nextLink to get the + * next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface ListVpnConnectionsResult extends Array { + nextLink?: string; +} diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index 38bb14561f..a4f8ac0372 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -62,6 +62,8 @@ exports.ApplicationGatewayRedirectConfiguration = require('./applicationGatewayR exports.ApplicationGatewayUrlPathMap = require('./applicationGatewayUrlPathMap'); exports.ApplicationGatewayFirewallDisabledRuleGroup = require('./applicationGatewayFirewallDisabledRuleGroup'); exports.ApplicationGatewayWebApplicationFirewallConfiguration = require('./applicationGatewayWebApplicationFirewallConfiguration'); +exports.ApplicationGatewayAutoscaleBounds = require('./applicationGatewayAutoscaleBounds'); +exports.ApplicationGatewayAutoscaleConfiguration = require('./applicationGatewayAutoscaleConfiguration'); exports.ApplicationGateway = require('./applicationGateway'); exports.ApplicationGatewayFirewallRule = require('./applicationGatewayFirewallRule'); exports.ApplicationGatewayFirewallRuleGroup = require('./applicationGatewayFirewallRuleGroup'); @@ -212,6 +214,16 @@ exports.VpnClientIPsecParameters = require('./vpnClientIPsecParameters'); exports.VirtualNetworkConnectionGatewayReference = require('./virtualNetworkConnectionGatewayReference'); exports.VirtualNetworkGatewayConnectionListEntity = require('./virtualNetworkGatewayConnectionListEntity'); exports.VpnDeviceScriptParameters = require('./vpnDeviceScriptParameters'); +exports.VirtualWAN = require('./virtualWAN'); +exports.DeviceProperties = require('./deviceProperties'); +exports.VpnSite = require('./vpnSite'); +exports.GetVpnSitesConfigurationRequest = require('./getVpnSitesConfigurationRequest'); +exports.HubVirtualNetworkConnection = require('./hubVirtualNetworkConnection'); +exports.VirtualHub = require('./virtualHub'); +exports.VpnConnection = require('./vpnConnection'); +exports.Policies = require('./policies'); +exports.VpnGateway = require('./vpnGateway'); +exports.VpnSiteId = require('./vpnSiteId'); exports.ApplicationGatewayListResult = require('./applicationGatewayListResult'); exports.ApplicationGatewayAvailableSslPredefinedPolicies = require('./applicationGatewayAvailableSslPredefinedPolicies'); exports.ApplicationSecurityGroupListResult = require('./applicationSecurityGroupListResult'); @@ -253,3 +265,9 @@ exports.VirtualNetworkGatewayListResult = require('./virtualNetworkGatewayListRe exports.VirtualNetworkGatewayListConnectionsResult = require('./virtualNetworkGatewayListConnectionsResult'); exports.VirtualNetworkGatewayConnectionListResult = require('./virtualNetworkGatewayConnectionListResult'); exports.LocalNetworkGatewayListResult = require('./localNetworkGatewayListResult'); +exports.ListVirtualWANsResult = require('./listVirtualWANsResult'); +exports.ListVpnSitesResult = require('./listVpnSitesResult'); +exports.ListVirtualHubsResult = require('./listVirtualHubsResult'); +exports.ListHubVirtualNetworkConnectionsResult = require('./listHubVirtualNetworkConnectionsResult'); +exports.ListVpnGatewaysResult = require('./listVpnGatewaysResult'); +exports.ListVpnConnectionsResult = require('./listVpnConnectionsResult'); diff --git a/lib/services/networkManagement2/lib/models/listHubVirtualNetworkConnectionsResult.js b/lib/services/networkManagement2/lib/models/listHubVirtualNetworkConnectionsResult.js new file mode 100644 index 0000000000..8c7741dbc1 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listHubVirtualNetworkConnectionsResult.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * List of HubVirtualNetworkConnections and a URL nextLink to get the next set + * of results. + */ +class ListHubVirtualNetworkConnectionsResult extends Array { + /** + * Create a ListHubVirtualNetworkConnectionsResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListHubVirtualNetworkConnectionsResult + * + * @returns {object} metadata of ListHubVirtualNetworkConnectionsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListHubVirtualNetworkConnectionsResult', + type: { + name: 'Composite', + className: 'ListHubVirtualNetworkConnectionsResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HubVirtualNetworkConnectionElementType', + type: { + name: 'Composite', + className: 'HubVirtualNetworkConnection' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListHubVirtualNetworkConnectionsResult; diff --git a/lib/services/networkManagement2/lib/models/listVirtualHubsResult.js b/lib/services/networkManagement2/lib/models/listVirtualHubsResult.js new file mode 100644 index 0000000000..60052e6e7d --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listVirtualHubsResult.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Result of the request to list VirtualHubs. It contains a list of VirtualHubs + * and a URL nextLink to get the next set of results. + */ +class ListVirtualHubsResult extends Array { + /** + * Create a ListVirtualHubsResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListVirtualHubsResult + * + * @returns {object} metadata of ListVirtualHubsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListVirtualHubsResult', + type: { + name: 'Composite', + className: 'ListVirtualHubsResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualHubElementType', + type: { + name: 'Composite', + className: 'VirtualHub' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListVirtualHubsResult; diff --git a/lib/services/networkManagement2/lib/models/listVirtualWANsResult.js b/lib/services/networkManagement2/lib/models/listVirtualWANsResult.js new file mode 100644 index 0000000000..2f58389096 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listVirtualWANsResult.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Result of the request to list VirtualWANs. It contains a list of VirtualWANs + * and a URL nextLink to get the next set of results. + */ +class ListVirtualWANsResult extends Array { + /** + * Create a ListVirtualWANsResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListVirtualWANsResult + * + * @returns {object} metadata of ListVirtualWANsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListVirtualWANsResult', + type: { + name: 'Composite', + className: 'ListVirtualWANsResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualWANElementType', + type: { + name: 'Composite', + className: 'VirtualWAN' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListVirtualWANsResult; diff --git a/lib/services/networkManagement2/lib/models/listVpnConnectionsResult.js b/lib/services/networkManagement2/lib/models/listVpnConnectionsResult.js new file mode 100644 index 0000000000..91652c5497 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listVpnConnectionsResult.js @@ -0,0 +1,70 @@ +/* + * 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'; + +/** + * Result of the request to list all vpn connections to a virtual wan vpn + * gateway. It contains a list of Vpn Connections and a URL nextLink to get the + * next set of results. + */ +class ListVpnConnectionsResult extends Array { + /** + * Create a ListVpnConnectionsResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListVpnConnectionsResult + * + * @returns {object} metadata of ListVpnConnectionsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListVpnConnectionsResult', + type: { + name: 'Composite', + className: 'ListVpnConnectionsResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnConnectionElementType', + type: { + name: 'Composite', + className: 'VpnConnection' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListVpnConnectionsResult; diff --git a/lib/services/networkManagement2/lib/models/listVpnGatewaysResult.js b/lib/services/networkManagement2/lib/models/listVpnGatewaysResult.js new file mode 100644 index 0000000000..b840abe313 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listVpnGatewaysResult.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Result of the request to list VpnGateways. It contains a list of VpnGateways + * and a URL nextLink to get the next set of results. + */ +class ListVpnGatewaysResult extends Array { + /** + * Create a ListVpnGatewaysResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListVpnGatewaysResult + * + * @returns {object} metadata of ListVpnGatewaysResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListVpnGatewaysResult', + type: { + name: 'Composite', + className: 'ListVpnGatewaysResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnGatewayElementType', + type: { + name: 'Composite', + className: 'VpnGateway' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListVpnGatewaysResult; diff --git a/lib/services/networkManagement2/lib/models/listVpnSitesResult.js b/lib/services/networkManagement2/lib/models/listVpnSitesResult.js new file mode 100644 index 0000000000..b704f0b2e5 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/listVpnSitesResult.js @@ -0,0 +1,69 @@ +/* + * 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'; + +/** + * Result of the request to list VpnSites. It contains a list of VpnSites and a + * URL nextLink to get the next set of results. + */ +class ListVpnSitesResult extends Array { + /** + * Create a ListVpnSitesResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ListVpnSitesResult + * + * @returns {object} metadata of ListVpnSitesResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ListVpnSitesResult', + type: { + name: 'Composite', + className: 'ListVpnSitesResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnSiteElementType', + type: { + name: 'Composite', + className: 'VpnSite' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ListVpnSitesResult; diff --git a/lib/services/networkManagement2/lib/models/policies.js b/lib/services/networkManagement2/lib/models/policies.js new file mode 100644 index 0000000000..4e6e439be3 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/policies.js @@ -0,0 +1,62 @@ +/* + * 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'; + +/** + * Policies for vpn gateway. + * + */ +class Policies { + /** + * Create a Policies. + * @member {boolean} [allowBranchToBranchTraffic] True if branch to branch + * traffic is allowed. + * @member {boolean} [allowVnetToVnetTraffic] True if Vnet to Vnet traffic is + * allowed. + */ + constructor() { + } + + /** + * Defines the metadata of Policies + * + * @returns {object} metadata of Policies + * + */ + mapper() { + return { + required: false, + serializedName: 'Policies', + type: { + name: 'Composite', + className: 'Policies', + modelProperties: { + allowBranchToBranchTraffic: { + required: false, + serializedName: 'allowBranchToBranchTraffic', + type: { + name: 'Boolean' + } + }, + allowVnetToVnetTraffic: { + required: false, + serializedName: 'allowVnetToVnetTraffic', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = Policies; diff --git a/lib/services/networkManagement2/lib/models/virtualHub.js b/lib/services/networkManagement2/lib/models/virtualHub.js new file mode 100644 index 0000000000..57bb504dfe --- /dev/null +++ b/lib/services/networkManagement2/lib/models/virtualHub.js @@ -0,0 +1,148 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * VirtualHub Resource. + * + * @extends models['Resource'] + */ +class VirtualHub extends models['Resource'] { + /** + * Create a VirtualHub. + * @member {object} [virtualWan] The VirtualWAN to which the VirtualHub + * belongs + * @member {string} [virtualWan.id] Resource ID. + * @member {array} [hubVirtualNetworkConnections] list of all vnet + * connections with this VirtualHub. + * @member {string} [addressPrefix] Address-prefix for this VirtualHub. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualHub + * + * @returns {object} metadata of VirtualHub + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualHub', + type: { + name: 'Composite', + className: 'VirtualHub', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + virtualWan: { + required: false, + serializedName: 'properties.virtualWan', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + hubVirtualNetworkConnections: { + required: false, + serializedName: 'properties.hubVirtualNetworkConnections', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'HubVirtualNetworkConnectionElementType', + type: { + name: 'Composite', + className: 'HubVirtualNetworkConnection' + } + } + } + }, + addressPrefix: { + required: false, + serializedName: 'properties.addressPrefix', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualHub; diff --git a/lib/services/networkManagement2/lib/models/virtualWAN.js b/lib/services/networkManagement2/lib/models/virtualWAN.js new file mode 100644 index 0000000000..7e36a55266 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/virtualWAN.js @@ -0,0 +1,155 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * VirtualWAN Resource. + * + * @extends models['Resource'] + */ +class VirtualWAN extends models['Resource'] { + /** + * Create a VirtualWAN. + * @member {boolean} [disableVpnEncryption] Vpn encryption to be disabled or + * not. + * @member {array} [virtualHubs] List of VirtualHubs in the VirtualWAN. + * @member {array} [vpnSites] + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualWAN + * + * @returns {object} metadata of VirtualWAN + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualWAN', + type: { + name: 'Composite', + className: 'VirtualWAN', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + disableVpnEncryption: { + required: false, + serializedName: 'properties.disableVpnEncryption', + type: { + name: 'Boolean' + } + }, + virtualHubs: { + required: false, + readOnly: true, + serializedName: 'properties.virtualHubs', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + vpnSites: { + required: false, + readOnly: true, + serializedName: 'properties.vpnSites', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualWAN; diff --git a/lib/services/networkManagement2/lib/models/vpnConnection.js b/lib/services/networkManagement2/lib/models/vpnConnection.js new file mode 100644 index 0000000000..7b6eac00b2 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/vpnConnection.js @@ -0,0 +1,199 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * VpnConnection Resource. + * + * @extends models['Resource'] + */ +class VpnConnection extends models['Resource'] { + /** + * Create a VpnConnection. + * @member {object} [remoteVpnSite] Id of the connected vpn site. + * @member {string} [remoteVpnSite.id] Resource ID. + * @member {number} [routingWeight] routing weight for vpn connection. + * @member {string} [connectionStatus] The connection status. Possible values + * include: 'Unknown', 'Connecting', 'Connected', 'NotConnected' + * @member {number} [ingressBytesTransferred] Ingress bytes transferred. + * @member {number} [egressBytesTransferred] Egress bytes transferred. + * @member {number} [connectionBandwidthInMbps] Expected bandwidth in MBPS. + * @member {string} [sharedKey] SharedKey for the vpn connection. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by + * this connection. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VpnConnection + * + * @returns {object} metadata of VpnConnection + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnConnection', + type: { + name: 'Composite', + className: 'VpnConnection', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + remoteVpnSite: { + required: false, + serializedName: 'properties.remoteVpnSite', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + routingWeight: { + required: false, + serializedName: 'properties.routingWeight', + type: { + name: 'Number' + } + }, + connectionStatus: { + required: false, + serializedName: 'properties.connectionStatus', + type: { + name: 'String' + } + }, + ingressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.ingressBytesTransferred', + type: { + name: 'Number' + } + }, + egressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.egressBytesTransferred', + type: { + name: 'Number' + } + }, + connectionBandwidthInMbps: { + required: false, + readOnly: true, + serializedName: 'properties.connectionBandwidthInMbps', + type: { + name: 'Number' + } + }, + sharedKey: { + required: false, + serializedName: 'properties.sharedKey', + type: { + name: 'String' + } + }, + enableBgp: { + required: false, + serializedName: 'properties.enableBgp', + type: { + name: 'Boolean' + } + }, + ipsecPolicies: { + required: false, + serializedName: 'properties.ipsecPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IpsecPolicyElementType', + type: { + name: 'Composite', + className: 'IpsecPolicy' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnConnection; diff --git a/lib/services/networkManagement2/lib/models/vpnGateway.js b/lib/services/networkManagement2/lib/models/vpnGateway.js new file mode 100644 index 0000000000..574f18446e --- /dev/null +++ b/lib/services/networkManagement2/lib/models/vpnGateway.js @@ -0,0 +1,166 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * VpnGateway Resource. + * + * @extends models['Resource'] + */ +class VpnGateway extends models['Resource'] { + /** + * Create a VpnGateway. + * @member {object} [virtualHub] The VirtualHub to which the gateway belongs + * @member {string} [virtualHub.id] Resource ID. + * @member {array} [connections] list of all vpn connections to the gateway. + * @member {object} [bgpSettings] Local network gateway's BGP speaker + * settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address + * and BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes + * learned from this BGP speaker. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {object} [policies] The policies applied to this vpn gateway. + * @member {boolean} [policies.allowBranchToBranchTraffic] True if branch to + * branch traffic is allowed. + * @member {boolean} [policies.allowVnetToVnetTraffic] True if Vnet to Vnet + * traffic is allowed. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VpnGateway + * + * @returns {object} metadata of VpnGateway + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnGateway', + type: { + name: 'Composite', + className: 'VpnGateway', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + virtualHub: { + required: false, + serializedName: 'properties.virtualHub', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + connections: { + required: false, + serializedName: 'properties.connections', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnConnectionElementType', + type: { + name: 'Composite', + className: 'VpnConnection' + } + } + } + }, + bgpSettings: { + required: false, + serializedName: 'properties.bgpSettings', + type: { + name: 'Composite', + className: 'BgpSettings' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + policies: { + required: false, + serializedName: 'properties.policies', + type: { + name: 'Composite', + className: 'Policies' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnGateway; diff --git a/lib/services/networkManagement2/lib/models/vpnSite.js b/lib/services/networkManagement2/lib/models/vpnSite.js new file mode 100644 index 0000000000..c7dab1c028 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/vpnSite.js @@ -0,0 +1,178 @@ +/* + * 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'; + +const models = require('./index'); + +/** + * VpnSite Resource. + * + * @extends models['Resource'] + */ +class VpnSite extends models['Resource'] { + /** + * Create a VpnSite. + * @member {object} [virtualWAN] The VirtualWAN to which the vpnSite belongs + * @member {string} [virtualWAN.id] Resource ID. + * @member {object} [deviceProperties] The device properties + * @member {string} [deviceProperties.deviceVendor] Name of the device + * Vendor. + * @member {string} [deviceProperties.deviceModel] Model of the device. + * @member {number} [deviceProperties.linkSpeedInMbps] Link speed. + * @member {string} [ipAddress] The ip-address for the vpn-site. + * @member {string} [siteKey] The key for vpn-site that can be used for + * connections. + * @member {object} [addressSpace] The AddressSpace that contains an array of + * IP address ranges. + * @member {array} [addressSpace.addressPrefixes] A list of address blocks + * reserved for this virtual network in CIDR notation. + * @member {object} [bgpProperties] The set of bgp properties. + * @member {number} [bgpProperties.asn] The BGP speaker's ASN. + * @member {string} [bgpProperties.bgpPeeringAddress] The BGP peering address + * and BGP identifier of this BGP speaker. + * @member {number} [bgpProperties.peerWeight] The weight added to routes + * learned from this BGP speaker. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VpnSite + * + * @returns {object} metadata of VpnSite + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnSite', + type: { + name: 'Composite', + className: 'VpnSite', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + virtualWAN: { + required: false, + serializedName: 'properties.virtualWAN', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + deviceProperties: { + required: false, + serializedName: 'properties.deviceProperties', + type: { + name: 'Composite', + className: 'DeviceProperties' + } + }, + ipAddress: { + required: false, + serializedName: 'properties.ipAddress', + type: { + name: 'String' + } + }, + siteKey: { + required: false, + serializedName: 'properties.siteKey', + type: { + name: 'String' + } + }, + addressSpace: { + required: false, + serializedName: 'properties.addressSpace', + type: { + name: 'Composite', + className: 'AddressSpace' + } + }, + bgpProperties: { + required: false, + serializedName: 'properties.bgpProperties', + type: { + name: 'Composite', + className: 'BgpSettings' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnSite; diff --git a/lib/services/networkManagement2/lib/models/vpnSiteId.js b/lib/services/networkManagement2/lib/models/vpnSiteId.js new file mode 100644 index 0000000000..f00971195c --- /dev/null +++ b/lib/services/networkManagement2/lib/models/vpnSiteId.js @@ -0,0 +1,54 @@ +/* + * 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'; + +/** + * VpnSite Resource. + * + */ +class VpnSiteId { + /** + * Create a VpnSiteId. + * @member {string} [vpnSite] The resource-uri of the vpn-site for which + * config is to be fetched. + */ + constructor() { + } + + /** + * Defines the metadata of VpnSiteId + * + * @returns {object} metadata of VpnSiteId + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnSiteId', + type: { + name: 'Composite', + className: 'VpnSiteId', + modelProperties: { + vpnSite: { + required: false, + readOnly: true, + serializedName: 'vpnSite', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnSiteId; diff --git a/lib/services/networkManagement2/lib/networkManagementClient.d.ts b/lib/services/networkManagement2/lib/networkManagementClient.d.ts index 259f40a1a6..a1a1583de3 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.d.ts +++ b/lib/services/networkManagement2/lib/networkManagementClient.d.ts @@ -95,6 +95,13 @@ export default class NetworkManagementClient extends AzureServiceClient { virtualNetworkGateways: operations.VirtualNetworkGateways; virtualNetworkGatewayConnections: operations.VirtualNetworkGatewayConnections; localNetworkGateways: operations.LocalNetworkGateways; + virtualWANs: operations.VirtualWANs; + vpnSites: operations.VpnSites; + vpnSitesConfiguration: operations.VpnSitesConfiguration; + virtualHubs: operations.VirtualHubs; + hubVirtualNetworkConnections: operations.HubVirtualNetworkConnections; + vpnGateways: operations.VpnGateways; + vpnConnections: operations.VpnConnections; /** diff --git a/lib/services/networkManagement2/lib/networkManagementClient.js b/lib/services/networkManagement2/lib/networkManagementClient.js index 6fc0cef11a..52ca27a6c6 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.js +++ b/lib/services/networkManagement2/lib/networkManagementClient.js @@ -259,6 +259,13 @@ class NetworkManagementClient extends ServiceClient { this.virtualNetworkGateways = new operations.VirtualNetworkGateways(this); this.virtualNetworkGatewayConnections = new operations.VirtualNetworkGatewayConnections(this); this.localNetworkGateways = new operations.LocalNetworkGateways(this); + this.virtualWANs = new operations.VirtualWANs(this); + this.vpnSites = new operations.VpnSites(this); + this.vpnSitesConfiguration = new operations.VpnSitesConfiguration(this); + this.virtualHubs = new operations.VirtualHubs(this); + this.hubVirtualNetworkConnections = new operations.HubVirtualNetworkConnections(this); + this.vpnGateways = new operations.VpnGateways(this); + this.vpnConnections = new operations.VpnConnections(this); this.models = models; this._checkDnsNameAvailability = _checkDnsNameAvailability; msRest.addSerializationMixin(this); diff --git a/lib/services/networkManagement2/lib/operations/applicationGateways.js b/lib/services/networkManagement2/lib/operations/applicationGateways.js index 50e8095f35..fd8bece444 100644 --- a/lib/services/networkManagement2/lib/operations/applicationGateways.js +++ b/lib/services/networkManagement2/lib/operations/applicationGateways.js @@ -235,10 +235,10 @@ function _get(resourceGroupName, applicationGatewayName, options, callback) { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -332,6 +332,19 @@ function _get(resourceGroupName, applicationGatewayName, options, callback) { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -342,6 +355,9 @@ function _get(resourceGroupName, applicationGatewayName, options, callback) { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -1655,10 +1671,10 @@ function _beginDeleteMethod(resourceGroupName, applicationGatewayName, options, * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -1752,6 +1768,19 @@ function _beginDeleteMethod(resourceGroupName, applicationGatewayName, options, * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -1762,6 +1791,9 @@ function _beginDeleteMethod(resourceGroupName, applicationGatewayName, options, * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -3110,10 +3142,10 @@ class ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -3207,6 +3239,19 @@ class ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -3217,6 +3262,9 @@ class ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -3262,10 +3310,10 @@ class ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -3359,6 +3407,19 @@ class ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -3369,6 +3430,9 @@ class ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -4366,10 +4430,10 @@ class ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -4463,6 +4527,19 @@ class ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -4473,6 +4550,9 @@ class ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -4518,10 +4598,10 @@ class ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -4615,6 +4695,19 @@ class ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -4625,6 +4718,9 @@ class ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. diff --git a/lib/services/networkManagement2/lib/operations/expressRouteCircuitPeerings.js b/lib/services/networkManagement2/lib/operations/expressRouteCircuitPeerings.js index 64f54dfd86..4adf907ca0 100644 --- a/lib/services/networkManagement2/lib/operations/expressRouteCircuitPeerings.js +++ b/lib/services/networkManagement2/lib/operations/expressRouteCircuitPeerings.js @@ -80,7 +80,7 @@ function _deleteMethod(resourceGroupName, circuitName, peeringName, options, cal } /** - * Gets the specified authorization from the specified express route circuit. + * Gets the specified peering for the express route circuit. * * @param {string} resourceGroupName The name of the resource group. * @@ -1264,7 +1264,7 @@ class ExpressRouteCircuitPeerings { } /** - * Gets the specified authorization from the specified express route circuit. + * Gets the specified peering for the express route circuit. * * @param {string} resourceGroupName The name of the resource group. * @@ -1298,7 +1298,7 @@ class ExpressRouteCircuitPeerings { } /** - * Gets the specified authorization from the specified express route circuit. + * Gets the specified peering for the express route circuit. * * @param {string} resourceGroupName The name of the resource group. * diff --git a/lib/services/networkManagement2/lib/operations/hubVirtualNetworkConnections.js b/lib/services/networkManagement2/lib/operations/hubVirtualNetworkConnections.js new file mode 100644 index 0000000000..43c41ec915 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/hubVirtualNetworkConnections.js @@ -0,0 +1,720 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a HubVirtualNetworkConnection. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 HubVirtualNetworkConnection} 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 _get(resourceGroupName, virtualHubName, connectionName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName 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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections/{connectionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['HubVirtualNetworkConnection']().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); + }); +} + +/** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 ListHubVirtualNetworkConnectionsResult} 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 _list(resourceGroupName, virtualHubName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName 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.Network/virtualHubs/{virtualHubName}/hubVirtualNetworkConnections'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListHubVirtualNetworkConnectionsResult']().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); + }); +} + +/** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListHubVirtualNetworkConnectionsResult} 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 _listNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListHubVirtualNetworkConnectionsResult']().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); + }); +} + +/** Class representing a HubVirtualNetworkConnections. */ +class HubVirtualNetworkConnections { + /** + * Create a HubVirtualNetworkConnections. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Retrieves the details of a HubVirtualNetworkConnection. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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, virtualHubName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualHubName, connectionName, 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 details of a HubVirtualNetworkConnection. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 {HubVirtualNetworkConnection} - 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 HubVirtualNetworkConnection} 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. + */ + get(resourceGroupName, virtualHubName, connectionName, 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._get(resourceGroupName, virtualHubName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualHubName, connectionName, options, optionalCallback); + } + } + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName, virtualHubName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, virtualHubName, 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 details of all HubVirtualNetworkConnections. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 {ListHubVirtualNetworkConnectionsResult} - 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 ListHubVirtualNetworkConnectionsResult} 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(resourceGroupName, virtualHubName, 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(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, virtualHubName, options, optionalCallback); + } + } + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, 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 details of all HubVirtualNetworkConnections. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListHubVirtualNetworkConnectionsResult} - 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 ListHubVirtualNetworkConnectionsResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = HubVirtualNetworkConnections; diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index ced731dfb1..8a666d33a0 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -152,10 +152,10 @@ export interface ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -249,6 +249,19 @@ export interface ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -259,6 +272,9 @@ export interface ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -292,10 +308,10 @@ export interface ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -389,6 +405,19 @@ export interface ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -399,6 +428,9 @@ export interface ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -1084,10 +1116,10 @@ export interface ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -1181,6 +1213,19 @@ export interface ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -1191,6 +1236,9 @@ export interface ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -1224,10 +1272,10 @@ export interface ApplicationGateways { * * @param {string} [parameters.sku.name] Name of an application gateway SKU. * Possible values include: 'Standard_Small', 'Standard_Medium', - * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * 'Standard_Large', 'WAF_Medium', 'WAF_Large', 'Standard_v2', 'WAF_v2' * * @param {string} [parameters.sku.tier] Tier of an application gateway. - * Possible values include: 'Standard', 'WAF' + * Possible values include: 'Standard', 'WAF', 'Standard_v2', 'WAF_v2' * * @param {number} [parameters.sku.capacity] Capacity (instance count) of an * application gateway. @@ -1321,6 +1369,19 @@ export interface ApplicationGateways { * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the * application gateway resource. * + * @param {boolean} [parameters.enableFips] Whether FIPS is enabled on the + * application gateway resource. + * + * @param {object} [parameters.autoscaleConfiguration] Autoscale Configuration. + * + * @param {object} parameters.autoscaleConfiguration.bounds Autoscale bounds + * + * @param {number} parameters.autoscaleConfiguration.bounds.min Lower bound on + * number of Application Gateway instances. + * + * @param {number} parameters.autoscaleConfiguration.bounds.max Upper bound on + * number of Application Gateway instances. + * * @param {string} [parameters.resourceGuid] Resource GUID property of the * application gateway resource. * @@ -1331,6 +1392,9 @@ export interface ApplicationGateways { * @param {string} [parameters.etag] A unique read-only string that changes * whenever the resource is updated. * + * @param {array} [parameters.zones] A list of availability zones denoting + * where the resource needs to come from. + * * @param {string} [parameters.id] Resource ID. * * @param {string} [parameters.location] Resource location. @@ -3648,7 +3712,7 @@ export interface ExpressRouteCircuitPeerings { /** - * Gets the specified authorization from the specified express route circuit. + * Gets the specified peering for the express route circuit. * * @param {string} resourceGroupName The name of the resource group. * @@ -3670,7 +3734,7 @@ export interface ExpressRouteCircuitPeerings { getWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** - * Gets the specified authorization from the specified express route circuit. + * Gets the specified peering for the express route circuit. * * @param {string} resourceGroupName The name of the resource group. * @@ -29061,11 +29125,11 @@ export interface VirtualNetworkGatewayConnections { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Updates a virtual network gateway connection tags. @@ -29092,7 +29156,7 @@ export interface VirtualNetworkGatewayConnections { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkGatewayConnectionListEntity} - The deserialized result object. + * @resolve {VirtualNetworkGatewayConnection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -29100,17 +29164,17 @@ export interface VirtualNetworkGatewayConnections { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkGatewayConnectionListEntity} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkGatewayConnectionListEntity} - * for more information. + * {VirtualNetworkGatewayConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} 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. */ - updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; - updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -29131,6 +29195,8 @@ export interface VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -29162,6 +29228,8 @@ export interface VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -29887,11 +29955,11 @@ export interface VirtualNetworkGatewayConnections { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. */ - beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Updates a virtual network gateway connection tags. @@ -29918,7 +29986,7 @@ export interface VirtualNetworkGatewayConnections { * * {Promise} A promise is returned. * - * @resolve {VirtualNetworkGatewayConnectionListEntity} - The deserialized result object. + * @resolve {VirtualNetworkGatewayConnection} - The deserialized result object. * * @reject {Error|ServiceError} - The error object. * @@ -29926,17 +29994,17 @@ export interface VirtualNetworkGatewayConnections { * * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. * - * {VirtualNetworkGatewayConnectionListEntity} [result] - The deserialized result object if an error did not occur. - * See {@link VirtualNetworkGatewayConnectionListEntity} - * for more information. + * {VirtualNetworkGatewayConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} 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. */ - beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; - beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** @@ -29957,6 +30025,8 @@ export interface VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -29988,6 +30058,8 @@ export interface VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -30869,3 +30941,4127 @@ export interface LocalNetworkGateways { listNext(nextPageLink: string, callback: ServiceCallback): void; listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } + +/** + * @class + * VirtualWANs + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualWANs { + + + /** + * Retrieves the details of a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being retrieved. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being retrieved. + * + * @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 {VirtualWAN} - 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. + * + * {VirtualWAN} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualWAN} 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. + */ + get(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualWANName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualWANName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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. + * + * {VirtualWAN} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualWAN} 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. + */ + createOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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. + * + * {VirtualWAN} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualWAN} 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. + */ + updateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + deleteMethod(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualWANName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualWANName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @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 {ListVirtualWANsResult} - 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. + * + * {ListVirtualWANsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualWANsResult} 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. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualWANs in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualWANs in a subscription. + * + * @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 {ListVirtualWANsResult} - 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. + * + * {ListVirtualWANsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualWANsResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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. + * + * {VirtualWAN} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualWAN} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualWANName: string, wANParameters: models.VirtualWAN, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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. + * + * {VirtualWAN} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualWAN} 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. + */ + beginUpdateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualWANName: string, wANParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + beginDeleteMethod(resourceGroupName: string, virtualWANName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualWANName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualWANName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualWANsResult} - 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. + * + * {ListVirtualWANsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualWANsResult} 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. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualWANs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualWANs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualWANsResult} - 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. + * + * {ListVirtualWANsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualWANsResult} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VpnSites + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VpnSites { + + + /** + * Retrieves the details of a VPNsite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being retrieved. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a VPNsite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being retrieved. + * + * @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 {VpnSite} - 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. + * + * {VpnSite} [result] - The deserialized result object if an error did not occur. + * See {@link VpnSite} 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. + */ + get(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, vpnSiteName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, vpnSiteName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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. + * + * {VpnSite} [result] - The deserialized result object if an error did not occur. + * See {@link VpnSite} 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. + */ + createOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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. + * + * {VpnSite} [result] - The deserialized result object if an error did not occur. + * See {@link VpnSite} 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. + */ + updateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + deleteMethod(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, vpnSiteName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, vpnSiteName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @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 {ListVpnSitesResult} - 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. + * + * {ListVpnSitesResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnSitesResult} 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. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnSites in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnSites in a subscription. + * + * @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 {ListVpnSitesResult} - 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. + * + * {ListVpnSitesResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnSitesResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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. + * + * {VpnSite} [result] - The deserialized result object if an error did not occur. + * See {@link VpnSite} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.VpnSite, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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. + * + * {VpnSite} [result] - The deserialized result object if an error did not occur. + * See {@link VpnSite} 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. + */ + beginUpdateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, vpnSiteName: string, vpnSiteParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + beginDeleteMethod(resourceGroupName: string, vpnSiteName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, vpnSiteName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, vpnSiteName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnSitesResult} - 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. + * + * {ListVpnSitesResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnSitesResult} 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. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnSites in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnSites in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnSitesResult} - 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. + * + * {ListVpnSitesResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnSitesResult} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VpnSitesConfiguration + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VpnSitesConfiguration { + + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + downloadWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + download(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + download(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, callback: ServiceCallback): void; + download(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + beginDownloadWithHttpOperationResponse(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + beginDownload(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDownload(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, callback: ServiceCallback): void; + beginDownload(resourceGroupName: string, virtualWANName: string, request: models.GetVpnSitesConfigurationRequest, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualHubs + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualHubs { + + + /** + * Retrieves the details of a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 {VirtualHub} - 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. + * + * {VirtualHub} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualHub} 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. + */ + get(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualHubName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualHubName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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. + * + * {VirtualHub} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualHub} 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. + */ + createOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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. + * + * {VirtualHub} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualHub} 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. + */ + updateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + deleteMethod(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualHubName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualHubName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @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 {ListVirtualHubsResult} - 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. + * + * {ListVirtualHubsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualHubsResult} 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. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualHubs in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualHubs in a subscription. + * + * @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 {ListVirtualHubsResult} - 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. + * + * {ListVirtualHubsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualHubsResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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. + * + * {VirtualHub} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualHub} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.VirtualHub, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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. + * + * {VirtualHub} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualHub} 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. + */ + beginUpdateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualHubName: string, virtualHubParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + beginDeleteMethod(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualHubName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualHubName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualHubsResult} - 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. + * + * {ListVirtualHubsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualHubsResult} 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. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VirtualHubs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VirtualHubs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualHubsResult} - 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. + * + * {ListVirtualHubsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVirtualHubsResult} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * HubVirtualNetworkConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface HubVirtualNetworkConnections { + + + /** + * Retrieves the details of a HubVirtualNetworkConnection. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a HubVirtualNetworkConnection. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 {HubVirtualNetworkConnection} - 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. + * + * {HubVirtualNetworkConnection} [result] - The deserialized result object if an error did not occur. + * See {@link HubVirtualNetworkConnection} 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. + */ + get(resourceGroupName: string, virtualHubName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualHubName: string, connectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualHubName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + listWithHttpOperationResponse(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 {ListHubVirtualNetworkConnectionsResult} - 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. + * + * {ListHubVirtualNetworkConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListHubVirtualNetworkConnectionsResult} 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. + */ + list(resourceGroupName: string, virtualHubName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, virtualHubName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, virtualHubName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of all HubVirtualNetworkConnections. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListHubVirtualNetworkConnectionsResult} - 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. + * + * {ListHubVirtualNetworkConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListHubVirtualNetworkConnectionsResult} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VpnGateways + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VpnGateways { + + + /** + * Retrieves the details of a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 {VpnGateway} - 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. + * + * {VpnGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VpnGateway} 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. + */ + get(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, gatewayName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, gatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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. + * + * {VpnGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VpnGateway} 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. + */ + createOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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. + * + * {VpnGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VpnGateway} 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. + */ + updateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + deleteMethod(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, gatewayName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, gatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @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. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @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 {ListVpnGatewaysResult} - 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. + * + * {ListVpnGatewaysResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnGatewaysResult} 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. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnGateways in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnGateways in a subscription. + * + * @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 {ListVpnGatewaysResult} - 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. + * + * {ListVpnGatewaysResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnGatewaysResult} 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. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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. + * + * {VpnGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VpnGateway} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.VpnGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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. + * + * {VpnGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VpnGateway} 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. + */ + beginUpdateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, gatewayName: string, vpnGatewayParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + beginDeleteMethod(resourceGroupName: string, gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, gatewayName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, gatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnGatewaysResult} - 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. + * + * {ListVpnGatewaysResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnGatewaysResult} 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. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all the VpnGateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all the VpnGateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnGatewaysResult} - 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. + * + * {ListVpnGatewaysResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnGatewaysResult} 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. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VpnConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VpnConnections { + + + /** + * Retrieves the details of a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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. + */ + getWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the details of a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 {VpnConnection} - 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. + * + * {VpnConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VpnConnection} 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. + */ + get(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, gatewayName: string, connectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, gatewayName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 {VpnConnection} - 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. + * + * {VpnConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VpnConnection} 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. + */ + createOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + deleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + listByVpnGatewayWithHttpOperationResponse(gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 {ListVpnConnectionsResult} - 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. + * + * {ListVpnConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnConnectionsResult} 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. + */ + listByVpnGateway(gatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByVpnGateway(gatewayName: string, callback: ServiceCallback): void; + listByVpnGateway(gatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 {VpnConnection} - 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. + * + * {VpnConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VpnConnection} 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. + */ + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, gatewayName: string, connectionName: string, vpnConnectionParameters: models.VpnConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + beginDeleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, gatewayName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByVpnGatewayNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnConnectionsResult} - 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. + * + * {ListVpnConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link ListVpnConnectionsResult} 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. + */ + listByVpnGatewayNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByVpnGatewayNext(nextPageLink: string, callback: ServiceCallback): void; + listByVpnGatewayNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/networkManagement2/lib/operations/index.js b/lib/services/networkManagement2/lib/operations/index.js index b71044c90d..0cfcd760de 100644 --- a/lib/services/networkManagement2/lib/operations/index.js +++ b/lib/services/networkManagement2/lib/operations/index.js @@ -55,3 +55,10 @@ exports.VirtualNetworkPeerings = require('./virtualNetworkPeerings'); exports.VirtualNetworkGateways = require('./virtualNetworkGateways'); exports.VirtualNetworkGatewayConnections = require('./virtualNetworkGatewayConnections'); exports.LocalNetworkGateways = require('./localNetworkGateways'); +exports.VirtualWANs = require('./virtualWANs'); +exports.VpnSites = require('./vpnSites'); +exports.VpnSitesConfiguration = require('./vpnSitesConfiguration'); +exports.VirtualHubs = require('./virtualHubs'); +exports.HubVirtualNetworkConnections = require('./hubVirtualNetworkConnections'); +exports.VpnGateways = require('./vpnGateways'); +exports.VpnConnections = require('./vpnConnections'); diff --git a/lib/services/networkManagement2/lib/operations/virtualHubs.js b/lib/services/networkManagement2/lib/operations/virtualHubs.js new file mode 100644 index 0000000000..53ac965b0b --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/virtualHubs.js @@ -0,0 +1,2519 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 VirtualHub} 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 _get(resourceGroupName, virtualHubName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName 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.Network/virtualHubs/{virtualHubName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['VirtualHub']().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); + }); +} + + +/** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 VirtualHub} 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 _createOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, 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.beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualHub']().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); + }); + }); +} + + +/** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 VirtualHub} 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 _updateTags(resourceGroupName, virtualHubName, virtualHubParameters, 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.beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualHub']().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); + }); + }); +} + + +/** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 _deleteMethod(resourceGroupName, virtualHubName, 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.beginDeleteMethod(resourceGroupName, virtualHubName, 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 all the VirtualHubs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @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 ListVirtualHubsResult} 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 _listByResourceGroup(resourceGroupName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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.Network/virtualHubs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualHubsResult']().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); + }); +} + +/** + * Lists all the VirtualHubs in a subscription. + * + * @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 ListVirtualHubsResult} 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 _list(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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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}/providers/Microsoft.Network/virtualHubs'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualHubsResult']().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); + }); +} + +/** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 VirtualHub} 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 _beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName cannot be null or undefined and it must be of type string.'); + } + if (virtualHubParameters === null || virtualHubParameters === undefined) { + throw new Error('virtualHubParameters 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.Network/virtualHubs/{virtualHubName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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 (virtualHubParameters !== null && virtualHubParameters !== undefined) { + let requestModelMapper = new client.models['VirtualHub']().mapper(); + requestModel = client.serialize(requestModelMapper, virtualHubParameters, 'virtualHubParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(virtualHubParameters, 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 !== 201) { + 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['ErrorModel']().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['VirtualHub']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualHub']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 VirtualHub} 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 _beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName cannot be null or undefined and it must be of type string.'); + } + if (virtualHubParameters === null || virtualHubParameters === undefined) { + throw new Error('virtualHubParameters 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.Network/virtualHubs/{virtualHubName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + 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 (virtualHubParameters !== null && virtualHubParameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, virtualHubParameters, 'virtualHubParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(virtualHubParameters, 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 !== 201) { + 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['ErrorModel']().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['VirtualHub']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualHub']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 _beginDeleteMethod(resourceGroupName, virtualHubName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualHubName === null || virtualHubName === undefined || typeof virtualHubName.valueOf() !== 'string') { + throw new Error('virtualHubName 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.Network/virtualHubs/{virtualHubName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualHubName}', encodeURIComponent(virtualHubName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + 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 && statusCode !== 202 && statusCode !== 204) { + 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['ErrorModel']().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); + }); +} + +/** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVirtualHubsResult} 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 _listByResourceGroupNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualHubsResult']().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); + }); +} + +/** + * Lists all the VirtualHubs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVirtualHubsResult} 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 _listNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualHubsResult']().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); + }); +} + +/** Class representing a VirtualHubs. */ +class VirtualHubs { + /** + * Create a VirtualHubs. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Retrieves the details of a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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, virtualHubName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualHubName, 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 details of a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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 {VirtualHub} - 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 VirtualHub} 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. + */ + get(resourceGroupName, virtualHubName, 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._get(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualHubName, options, optionalCallback); + } + } + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, virtualHubName, virtualHubParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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 VirtualHub} 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. + */ + createOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, 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._createOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, optionalCallback); + } + } + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, virtualHubName, virtualHubParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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 VirtualHub} 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. + */ + updateTags(resourceGroupName, virtualHubName, virtualHubParameters, 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._updateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, optionalCallback); + } + } + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualHubName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + deleteMethod(resourceGroupName, virtualHubName, 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._deleteMethod(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualHubName, options, optionalCallback); + } + } + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @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 VirtualHubs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @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 {ListVirtualHubsResult} - 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 ListVirtualHubsResult} 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 all the VirtualHubs in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 VirtualHubs in a subscription. + * + * @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 {ListVirtualHubsResult} - 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 ListVirtualHubsResult} 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); + } + } + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualHubName, virtualHubParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VirtualHub resource if it doesn't exist else updates the existing + * VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to create or update + * VirtualHub. + * + * @param {object} [virtualHubParameters.virtualWan] The VirtualWAN to which + * the VirtualHub belongs + * + * @param {string} [virtualHubParameters.virtualWan.id] Resource ID. + * + * @param {array} [virtualHubParameters.hubVirtualNetworkConnections] list of + * all vnet connections with this VirtualHub. + * + * @param {string} [virtualHubParameters.addressPrefix] Address-prefix for this + * VirtualHub. + * + * @param {string} [virtualHubParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [virtualHubParameters.id] Resource ID. + * + * @param {string} [virtualHubParameters.location] Resource location. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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 VirtualHub} 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. + */ + beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, 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._beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualHubName, virtualHubParameters, options, optionalCallback); + } + } + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, virtualHubName, virtualHubParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates VirtualHub tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @param {object} virtualHubParameters Parameters supplied to update + * VirtualHub tags. + * + * @param {object} [virtualHubParameters.tags] Resource tags. + * + * @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 {VirtualHub} - 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 VirtualHub} 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. + */ + beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, 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._beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, virtualHubName, virtualHubParameters, options, optionalCallback); + } + } + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualHubName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VirtualHub. + * + * @param {string} resourceGroupName The resource group name of the VirtualHub. + * + * @param {string} virtualHubName The name of the VirtualHub. + * + * @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. + */ + beginDeleteMethod(resourceGroupName, virtualHubName, 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._beginDeleteMethod(resourceGroupName, virtualHubName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualHubName, options, optionalCallback); + } + } + + /** + * Lists all the VirtualHubs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, 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 VirtualHubs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualHubsResult} - 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 ListVirtualHubsResult} 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. + */ + listByResourceGroupNext(nextPageLink, 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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all the VirtualHubs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, 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 VirtualHubs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualHubsResult} - 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 ListVirtualHubsResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualHubs; diff --git a/lib/services/networkManagement2/lib/operations/virtualNetworkGatewayConnections.js b/lib/services/networkManagement2/lib/operations/virtualNetworkGatewayConnections.js index 4cddf7e3ed..bc21a7e86f 100644 --- a/lib/services/networkManagement2/lib/operations/virtualNetworkGatewayConnections.js +++ b/lib/services/networkManagement2/lib/operations/virtualNetworkGatewayConnections.js @@ -502,8 +502,8 @@ function _deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, o * {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 VirtualNetworkGatewayConnectionListEntity} - * for more information. + * See {@link VirtualNetworkGatewayConnection} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -546,7 +546,7 @@ function _updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, par parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['VirtualNetworkGatewayConnectionListEntity']().mapper(); + let resultMapper = new client.models['VirtualNetworkGatewayConnection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -580,6 +580,8 @@ function _updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, par * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -1528,8 +1530,8 @@ function _beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionNa * {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 VirtualNetworkGatewayConnectionListEntity} - * for more information. + * See {@link VirtualNetworkGatewayConnection} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -1655,7 +1657,7 @@ function _beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName parsedResponse = JSON.parse(responseBody); result = JSON.parse(responseBody); if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['VirtualNetworkGatewayConnectionListEntity']().mapper(); + let resultMapper = new client.models['VirtualNetworkGatewayConnection']().mapper(); result = client.deserialize(resultMapper, parsedResponse, 'result'); } } catch (error) { @@ -1688,6 +1690,8 @@ function _beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2814,7 +2818,7 @@ class VirtualNetworkGatewayConnections { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -2857,7 +2861,7 @@ class VirtualNetworkGatewayConnections { * * {Promise} A promise is returned * - * @resolve {VirtualNetworkGatewayConnectionListEntity} - The deserialized result object. + * @resolve {VirtualNetworkGatewayConnection} - The deserialized result object. * * @reject {Error} - The error object. * @@ -2866,8 +2870,8 @@ class VirtualNetworkGatewayConnections { * {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 VirtualNetworkGatewayConnectionListEntity} - * for more information. + * See {@link VirtualNetworkGatewayConnection} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -2911,6 +2915,8 @@ class VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -2954,6 +2960,8 @@ class VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3829,7 +3837,7 @@ class VirtualNetworkGatewayConnections { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ @@ -3872,7 +3880,7 @@ class VirtualNetworkGatewayConnections { * * {Promise} A promise is returned * - * @resolve {VirtualNetworkGatewayConnectionListEntity} - The deserialized result object. + * @resolve {VirtualNetworkGatewayConnection} - The deserialized result object. * * @reject {Error} - The error object. * @@ -3881,8 +3889,8 @@ class VirtualNetworkGatewayConnections { * {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 VirtualNetworkGatewayConnectionListEntity} - * for more information. + * See {@link VirtualNetworkGatewayConnection} for more + * information. * * {object} [request] - The HTTP Request object if an error did not occur. * @@ -3926,6 +3934,8 @@ class VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the @@ -3969,6 +3979,8 @@ class VirtualNetworkGatewayConnections { * @param {string} parameters.value The virtual network connection shared key * value. * + * @param {string} [parameters.id] Resource ID. + * * @param {object} [options] Optional Parameters. * * @param {object} [options.customHeaders] Headers that will be added to the diff --git a/lib/services/networkManagement2/lib/operations/virtualWANs.js b/lib/services/networkManagement2/lib/operations/virtualWANs.js new file mode 100644 index 0000000000..20e55641f2 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/virtualWANs.js @@ -0,0 +1,2471 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being retrieved. + * + * @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 VirtualWAN} 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 _get(resourceGroupName, virtualWANName, 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.'); + } + let apiVersion = '2018-04-01'; + // Validate + try { + 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 (virtualWANName === null || virtualWANName === undefined || typeof virtualWANName.valueOf() !== 'string') { + throw new Error('virtualWANName cannot be null or undefined and it must be of type string.'); + } + 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 (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.Network/virtualWans/{VirtualWANName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{VirtualWANName}', encodeURIComponent(virtualWANName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['VirtualWAN']().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); + }); +} + + +/** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 VirtualWAN} 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 _createOrUpdate(resourceGroupName, virtualWANName, wANParameters, 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.beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualWAN']().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); + }); + }); +} + + +/** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 VirtualWAN} 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 _updateTags(resourceGroupName, virtualWANName, wANParameters, 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.beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualWAN']().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); + }); + }); +} + + +/** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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 _deleteMethod(resourceGroupName, virtualWANName, 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.beginDeleteMethod(resourceGroupName, virtualWANName, 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 all the VirtualWANs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @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 ListVirtualWANsResult} 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 _listByResourceGroup(resourceGroupName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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.Network/virtualWans'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualWANsResult']().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); + }); +} + +/** + * Lists all the VirtualWANs in a subscription. + * + * @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 ListVirtualWANsResult} 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 _list(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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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}/providers/Microsoft.Network/virtualWans'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualWANsResult']().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); + }); +} + +/** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 VirtualWAN} 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 _beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualWANName === null || virtualWANName === undefined || typeof virtualWANName.valueOf() !== 'string') { + throw new Error('virtualWANName cannot be null or undefined and it must be of type string.'); + } + if (wANParameters === null || wANParameters === undefined) { + throw new Error('wANParameters 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.Network/virtualWans/{VirtualWANName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{VirtualWANName}', encodeURIComponent(virtualWANName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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 (wANParameters !== null && wANParameters !== undefined) { + let requestModelMapper = new client.models['VirtualWAN']().mapper(); + requestModel = client.serialize(requestModelMapper, wANParameters, 'wANParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(wANParameters, 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 !== 201) { + 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['ErrorModel']().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['VirtualWAN']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualWAN']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 VirtualWAN} 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 _beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualWANName === null || virtualWANName === undefined || typeof virtualWANName.valueOf() !== 'string') { + throw new Error('virtualWANName cannot be null or undefined and it must be of type string.'); + } + if (wANParameters === null || wANParameters === undefined) { + throw new Error('wANParameters 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.Network/virtualWans/{VirtualWANName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{VirtualWANName}', encodeURIComponent(virtualWANName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + 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 (wANParameters !== null && wANParameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, wANParameters, 'wANParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(wANParameters, 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 !== 201) { + 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['ErrorModel']().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['VirtualWAN']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualWAN']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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 _beginDeleteMethod(resourceGroupName, virtualWANName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualWANName === null || virtualWANName === undefined || typeof virtualWANName.valueOf() !== 'string') { + throw new Error('virtualWANName 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.Network/virtualWans/{VirtualWANName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{VirtualWANName}', encodeURIComponent(virtualWANName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + 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 && statusCode !== 202 && statusCode !== 204) { + 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['ErrorModel']().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); + }); +} + +/** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVirtualWANsResult} 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 _listByResourceGroupNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualWANsResult']().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); + }); +} + +/** + * Lists all the VirtualWANs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVirtualWANsResult} 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 _listNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVirtualWANsResult']().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); + }); +} + +/** Class representing a VirtualWANs. */ +class VirtualWANs { + /** + * Create a VirtualWANs. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Retrieves the details of a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being retrieved. + * + * @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, virtualWANName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualWANName, 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 details of a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being retrieved. + * + * @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 {VirtualWAN} - 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 VirtualWAN} 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. + */ + get(resourceGroupName, virtualWANName, 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._get(resourceGroupName, virtualWANName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualWANName, options, optionalCallback); + } + } + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, virtualWANName, wANParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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 VirtualWAN} 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. + */ + createOrUpdate(resourceGroupName, virtualWANName, wANParameters, 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._createOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, optionalCallback); + } + } + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, virtualWANName, wANParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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 VirtualWAN} 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. + */ + updateTags(resourceGroupName, virtualWANName, wANParameters, 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._updateTags(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, virtualWANName, wANParameters, options, optionalCallback); + } + } + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualWANName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualWANName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + deleteMethod(resourceGroupName, virtualWANName, 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._deleteMethod(resourceGroupName, virtualWANName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualWANName, options, optionalCallback); + } + } + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @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 VirtualWANs in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @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 {ListVirtualWANsResult} - 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 ListVirtualWANsResult} 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 all the VirtualWANs in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 VirtualWANs in a subscription. + * + * @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 {ListVirtualWANsResult} - 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 ListVirtualWANsResult} 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); + } + } + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualWANName, wANParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VirtualWAN resource if it doesn't exist else updates the existing + * VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being created or + * updated. + * + * @param {object} wANParameters Parameters supplied to create or update + * VirtualWAN. + * + * @param {boolean} [wANParameters.disableVpnEncryption] Vpn encryption to be + * disabled or not. + * + * @param {string} [wANParameters.provisioningState] The provisioning state of + * the resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + * + * @param {string} [wANParameters.id] Resource ID. + * + * @param {string} [wANParameters.location] Resource location. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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 VirtualWAN} 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. + */ + beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, 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._beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualWANName, wANParameters, options, optionalCallback); + } + } + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, virtualWANName, wANParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a VirtualWAN tags. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being updated. + * + * @param {object} wANParameters Parameters supplied to Update VirtualWAN tags. + * + * @param {object} [wANParameters.tags] Resource tags. + * + * @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 {VirtualWAN} - 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 VirtualWAN} 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. + */ + beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, 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._beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, virtualWANName, wANParameters, options, optionalCallback); + } + } + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualWANName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualWANName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VirtualWAN. + * + * @param {string} resourceGroupName The resource group name of the VirtualWan. + * + * @param {string} virtualWANName The name of the VirtualWAN being deleted. + * + * @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. + */ + beginDeleteMethod(resourceGroupName, virtualWANName, 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._beginDeleteMethod(resourceGroupName, virtualWANName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualWANName, options, optionalCallback); + } + } + + /** + * Lists all the VirtualWANs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, 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 VirtualWANs in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualWANsResult} - 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 ListVirtualWANsResult} 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. + */ + listByResourceGroupNext(nextPageLink, 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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all the VirtualWANs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, 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 VirtualWANs in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVirtualWANsResult} - 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 ListVirtualWANsResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualWANs; diff --git a/lib/services/networkManagement2/lib/operations/vpnConnections.js b/lib/services/networkManagement2/lib/operations/vpnConnections.js new file mode 100644 index 0000000000..4f414488b9 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/vpnConnections.js @@ -0,0 +1,1735 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 VpnConnection} 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 _get(resourceGroupName, gatewayName, connectionName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['VpnConnection']().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); + }); +} + + +/** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 VpnConnection} 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 _createOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, 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.beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnConnection']().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); + }); + }); +} + + +/** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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 _deleteMethod(resourceGroupName, gatewayName, connectionName, 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.beginDeleteMethod(resourceGroupName, gatewayName, connectionName, 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); + }); + }); +} + +/** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 ListVpnConnectionsResult} 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 _listByVpnGateway(gatewayName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName 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}/providers/Microsoft.Network/vpnGateways/{gatewayName}/vpnConnections'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnConnectionsResult']().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); + }); +} + +/** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 VpnConnection} 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 _beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (vpnConnectionParameters === null || vpnConnectionParameters === undefined) { + throw new Error('vpnConnectionParameters 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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 (vpnConnectionParameters !== null && vpnConnectionParameters !== undefined) { + let requestModelMapper = new client.models['VpnConnection']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnConnectionParameters, 'vpnConnectionParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnConnectionParameters, 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 !== 201) { + 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['ErrorModel']().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['VpnConnection']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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 _beginDeleteMethod(resourceGroupName, gatewayName, connectionName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName 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.Network/vpnGateways/{gatewayName}/vpnConnections/{connectionName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + 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 && statusCode !== 202 && statusCode !== 204) { + 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['ErrorModel']().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); + }); +} + +/** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVpnConnectionsResult} 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 _listByVpnGatewayNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnConnectionsResult']().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); + }); +} + +/** Class representing a VpnConnections. */ +class VpnConnections { + /** + * Create a VpnConnections. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._deleteMethod = _deleteMethod; + this._listByVpnGateway = _listByVpnGateway; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByVpnGatewayNext = _listByVpnGatewayNext; + } + + /** + * Retrieves the details of a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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, gatewayName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, gatewayName, connectionName, 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 details of a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the vpn connection. + * + * @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 {VpnConnection} - 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 VpnConnection} 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. + */ + get(resourceGroupName, gatewayName, connectionName, 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._get(resourceGroupName, gatewayName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, gatewayName, connectionName, options, optionalCallback); + } + } + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 {VpnConnection} - 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 VpnConnection} 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. + */ + createOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, 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._createOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, optionalCallback); + } + } + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, gatewayName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, gatewayName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + deleteMethod(resourceGroupName, gatewayName, connectionName, 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._deleteMethod(resourceGroupName, gatewayName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, gatewayName, connectionName, options, optionalCallback); + } + } + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + listByVpnGatewayWithHttpOperationResponse(gatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByVpnGateway(gatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 {ListVpnConnectionsResult} - 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 ListVpnConnectionsResult} 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. + */ + listByVpnGateway(gatewayName, 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._listByVpnGateway(gatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByVpnGateway(gatewayName, options, optionalCallback); + } + } + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a vpn connection to a scalable vpn gateway if it doesn't exist else + * updates the existing connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @param {object} vpnConnectionParameters Parameters supplied to create or + * Update a VPN Connection. + * + * @param {object} [vpnConnectionParameters.remoteVpnSite] Id of the connected + * vpn site. + * + * @param {string} [vpnConnectionParameters.remoteVpnSite.id] Resource ID. + * + * @param {number} [vpnConnectionParameters.routingWeight] routing weight for + * vpn connection. + * + * @param {string} [vpnConnectionParameters.connectionStatus] The connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * + * @param {string} [vpnConnectionParameters.sharedKey] SharedKey for the vpn + * connection. + * + * @param {boolean} [vpnConnectionParameters.enableBgp] EnableBgp flag + * + * @param {array} [vpnConnectionParameters.ipsecPolicies] The IPSec Policies to + * be considered by this connection. + * + * @param {string} [vpnConnectionParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnConnectionParameters.id] Resource ID. + * + * @param {string} [vpnConnectionParameters.location] Resource location. + * + * @param {object} [vpnConnectionParameters.tags] Resource tags. + * + * @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 {VpnConnection} - 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 VpnConnection} 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. + */ + beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, 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._beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, gatewayName, connectionName, vpnConnectionParameters, options, optionalCallback); + } + } + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, gatewayName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, gatewayName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a vpn connection. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {string} connectionName The name of the connection. + * + * @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. + */ + beginDeleteMethod(resourceGroupName, gatewayName, connectionName, 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._beginDeleteMethod(resourceGroupName, gatewayName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, gatewayName, connectionName, options, optionalCallback); + } + } + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByVpnGatewayNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByVpnGatewayNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all vpn connections for a particular virtual wan vpn gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnConnectionsResult} - 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 ListVpnConnectionsResult} 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. + */ + listByVpnGatewayNext(nextPageLink, 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._listByVpnGatewayNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByVpnGatewayNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VpnConnections; diff --git a/lib/services/networkManagement2/lib/operations/vpnGateways.js b/lib/services/networkManagement2/lib/operations/vpnGateways.js new file mode 100644 index 0000000000..b0960ac27f --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/vpnGateways.js @@ -0,0 +1,2627 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 VpnGateway} 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 _get(resourceGroupName, gatewayName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName 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.Network/vpnGateways/{gatewayName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['VpnGateway']().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); + }); +} + + +/** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 VpnGateway} 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 _createOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, 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.beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnGateway']().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); + }); + }); +} + + +/** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 VpnGateway} 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 _updateTags(resourceGroupName, gatewayName, vpnGatewayParameters, 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.beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnGateway']().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); + }); + }); +} + + +/** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 _deleteMethod(resourceGroupName, gatewayName, 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.beginDeleteMethod(resourceGroupName, gatewayName, 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 all the VpnGateways in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @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 ListVpnGatewaysResult} 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 _listByResourceGroup(resourceGroupName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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.Network/vpnGateways'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnGatewaysResult']().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); + }); +} + +/** + * Lists all the VpnGateways in a subscription. + * + * @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 ListVpnGatewaysResult} 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 _list(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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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}/providers/Microsoft.Network/vpnGateways'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnGatewaysResult']().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); + }); +} + +/** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 VpnGateway} 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 _beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName cannot be null or undefined and it must be of type string.'); + } + if (vpnGatewayParameters === null || vpnGatewayParameters === undefined) { + throw new Error('vpnGatewayParameters 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.Network/vpnGateways/{gatewayName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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 (vpnGatewayParameters !== null && vpnGatewayParameters !== undefined) { + let requestModelMapper = new client.models['VpnGateway']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnGatewayParameters, 'vpnGatewayParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnGatewayParameters, 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 !== 201) { + 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['ErrorModel']().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['VpnGateway']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 VpnGateway} 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 _beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName cannot be null or undefined and it must be of type string.'); + } + if (vpnGatewayParameters === null || vpnGatewayParameters === undefined) { + throw new Error('vpnGatewayParameters 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.Network/vpnGateways/{gatewayName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + 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 (vpnGatewayParameters !== null && vpnGatewayParameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnGatewayParameters, 'vpnGatewayParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnGatewayParameters, 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 !== 201) { + 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['ErrorModel']().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['VpnGateway']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 _beginDeleteMethod(resourceGroupName, gatewayName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (gatewayName === null || gatewayName === undefined || typeof gatewayName.valueOf() !== 'string') { + throw new Error('gatewayName 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.Network/vpnGateways/{gatewayName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{gatewayName}', encodeURIComponent(gatewayName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + 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 && statusCode !== 202 && statusCode !== 204) { + 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['ErrorModel']().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); + }); +} + +/** + * Lists all the VpnGateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVpnGatewaysResult} 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 _listByResourceGroupNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnGatewaysResult']().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); + }); +} + +/** + * Lists all the VpnGateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVpnGatewaysResult} 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 _listNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnGatewaysResult']().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); + }); +} + +/** Class representing a VpnGateways. */ +class VpnGateways { + /** + * Create a VpnGateways. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Retrieves the details of a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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, gatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, gatewayName, 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 details of a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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 {VpnGateway} - 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 VpnGateway} 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. + */ + get(resourceGroupName, gatewayName, 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._get(resourceGroupName, gatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, gatewayName, options, optionalCallback); + } + } + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, gatewayName, vpnGatewayParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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 VpnGateway} 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. + */ + createOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, 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._createOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, optionalCallback); + } + } + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, gatewayName, vpnGatewayParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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 VpnGateway} 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. + */ + updateTags(resourceGroupName, gatewayName, vpnGatewayParameters, 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._updateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, optionalCallback); + } + } + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, gatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, gatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + deleteMethod(resourceGroupName, gatewayName, 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._deleteMethod(resourceGroupName, gatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, gatewayName, options, optionalCallback); + } + } + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @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 VpnGateways in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @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 {ListVpnGatewaysResult} - 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 ListVpnGatewaysResult} 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 all the VpnGateways in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 VpnGateways in a subscription. + * + * @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 {ListVpnGatewaysResult} - 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 ListVpnGatewaysResult} 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); + } + } + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, gatewayName, vpnGatewayParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a virtual wan vpn gateway if it doesn't exist else updates the + * existing gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to create or Update + * a virtual wan vpn gateway. + * + * @param {object} [vpnGatewayParameters.virtualHub] The VirtualHub to which + * the gateway belongs + * + * @param {string} [vpnGatewayParameters.virtualHub.id] Resource ID. + * + * @param {array} [vpnGatewayParameters.connections] list of all vpn + * connections to the gateway. + * + * @param {object} [vpnGatewayParameters.bgpSettings] Local network gateway's + * BGP speaker settings. + * + * @param {number} [vpnGatewayParameters.bgpSettings.asn] The BGP speaker's + * ASN. + * + * @param {string} [vpnGatewayParameters.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnGatewayParameters.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnGatewayParameters.provisioningState] The provisioning + * state of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {object} [vpnGatewayParameters.policies] The policies applied to this + * vpn gateway. + * + * @param {boolean} [vpnGatewayParameters.policies.allowBranchToBranchTraffic] + * True if branch to branch traffic is allowed. + * + * @param {boolean} [vpnGatewayParameters.policies.allowVnetToVnetTraffic] True + * if Vnet to Vnet traffic is allowed. + * + * @param {string} [vpnGatewayParameters.id] Resource ID. + * + * @param {string} [vpnGatewayParameters.location] Resource location. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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 VpnGateway} 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. + */ + beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, 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._beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, gatewayName, vpnGatewayParameters, options, optionalCallback); + } + } + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, gatewayName, vpnGatewayParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates virtual wan vpn gateway tags. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @param {object} vpnGatewayParameters Parameters supplied to update a virtual + * wan vpn gateway tags. + * + * @param {object} [vpnGatewayParameters.tags] Resource tags. + * + * @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 {VpnGateway} - 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 VpnGateway} 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. + */ + beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, 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._beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, gatewayName, vpnGatewayParameters, options, optionalCallback); + } + } + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, gatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, gatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a virtual wan vpn gateway. + * + * @param {string} resourceGroupName The resource group name of the VpnGateway. + * + * @param {string} gatewayName The name of the gateway. + * + * @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. + */ + beginDeleteMethod(resourceGroupName, gatewayName, 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._beginDeleteMethod(resourceGroupName, gatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, gatewayName, options, optionalCallback); + } + } + + /** + * Lists all the VpnGateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, 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 VpnGateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnGatewaysResult} - 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 ListVpnGatewaysResult} 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. + */ + listByResourceGroupNext(nextPageLink, 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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all the VpnGateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, 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 VpnGateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnGatewaysResult} - 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 ListVpnGatewaysResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VpnGateways; diff --git a/lib/services/networkManagement2/lib/operations/vpnSites.js b/lib/services/networkManagement2/lib/operations/vpnSites.js new file mode 100644 index 0000000000..6de36ae479 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/vpnSites.js @@ -0,0 +1,2687 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves the details of a VPNsite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being retrieved. + * + * @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 VpnSite} 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 _get(resourceGroupName, vpnSiteName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (vpnSiteName === null || vpnSiteName === undefined || typeof vpnSiteName.valueOf() !== 'string') { + throw new Error('vpnSiteName 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.Network/vpnSites/{vpnSiteName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vpnSiteName}', encodeURIComponent(vpnSiteName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['VpnSite']().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); + }); +} + + +/** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 VpnSite} 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 _createOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, 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.beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnSite']().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); + }); + }); +} + + +/** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 VpnSite} 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 _updateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, 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.beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, 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 + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnSite']().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); + }); + }); +} + + +/** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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 _deleteMethod(resourceGroupName, vpnSiteName, 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.beginDeleteMethod(resourceGroupName, vpnSiteName, 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 all the vpnSites in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @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 ListVpnSitesResult} 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 _listByResourceGroup(resourceGroupName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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.Network/vpnSites'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnSitesResult']().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); + }); +} + +/** + * Lists all the VpnSites in a subscription. + * + * @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 ListVpnSitesResult} 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 _list(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.'); + } + let apiVersion = '2018-04-01'; + // 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 (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}/providers/Microsoft.Network/vpnSites'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnSitesResult']().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); + }); +} + +/** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 VpnSite} 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 _beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (vpnSiteName === null || vpnSiteName === undefined || typeof vpnSiteName.valueOf() !== 'string') { + throw new Error('vpnSiteName cannot be null or undefined and it must be of type string.'); + } + if (vpnSiteParameters === null || vpnSiteParameters === undefined) { + throw new Error('vpnSiteParameters 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.Network/vpnSites/{vpnSiteName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vpnSiteName}', encodeURIComponent(vpnSiteName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + 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 (vpnSiteParameters !== null && vpnSiteParameters !== undefined) { + let requestModelMapper = new client.models['VpnSite']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnSiteParameters, 'vpnSiteParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnSiteParameters, 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 !== 201) { + 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['ErrorModel']().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['VpnSite']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnSite']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 VpnSite} 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 _beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (vpnSiteName === null || vpnSiteName === undefined || typeof vpnSiteName.valueOf() !== 'string') { + throw new Error('vpnSiteName cannot be null or undefined and it must be of type string.'); + } + if (vpnSiteParameters === null || vpnSiteParameters === undefined) { + throw new Error('vpnSiteParameters 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.Network/vpnSites/{vpnSiteName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vpnSiteName}', encodeURIComponent(vpnSiteName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + 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 (vpnSiteParameters !== null && vpnSiteParameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnSiteParameters, 'vpnSiteParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnSiteParameters, 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 !== 201) { + 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['ErrorModel']().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['VpnSite']().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); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnSite']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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 _beginDeleteMethod(resourceGroupName, vpnSiteName, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (vpnSiteName === null || vpnSiteName === undefined || typeof vpnSiteName.valueOf() !== 'string') { + throw new Error('vpnSiteName 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.Network/vpnSites/{vpnSiteName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{vpnSiteName}', encodeURIComponent(vpnSiteName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + 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 && statusCode !== 202 && statusCode !== 204) { + 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['ErrorModel']().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); + }); +} + +/** + * Lists all the vpnSites in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVpnSitesResult} 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 _listByResourceGroupNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnSitesResult']().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); + }); +} + +/** + * Lists all the VpnSites in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 ListVpnSitesResult} 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 _listNext(nextPageLink, 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 (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink 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 requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + 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) { + 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['ErrorModel']().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['ListVpnSitesResult']().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); + }); +} + +/** Class representing a VpnSites. */ +class VpnSites { + /** + * Create a VpnSites. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._deleteMethod = _deleteMethod; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginDeleteMethod = _beginDeleteMethod; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Retrieves the details of a VPNsite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being retrieved. + * + * @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, vpnSiteName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, vpnSiteName, 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 details of a VPNsite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being retrieved. + * + * @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 {VpnSite} - 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 VpnSite} 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. + */ + get(resourceGroupName, vpnSiteName, 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._get(resourceGroupName, vpnSiteName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, vpnSiteName, options, optionalCallback); + } + } + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, vpnSiteName, vpnSiteParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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 VpnSite} 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. + */ + createOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, 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._createOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, optionalCallback); + } + } + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, vpnSiteName, vpnSiteParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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 VpnSite} 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. + */ + updateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, 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._updateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, optionalCallback); + } + } + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, vpnSiteName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, vpnSiteName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + deleteMethod(resourceGroupName, vpnSiteName, 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._deleteMethod(resourceGroupName, vpnSiteName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, vpnSiteName, options, optionalCallback); + } + } + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @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 vpnSites in a resource group. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @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 {ListVpnSitesResult} - 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 ListVpnSitesResult} 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 all the VpnSites in a subscription. + * + * @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. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(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 VpnSites in a subscription. + * + * @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 {ListVpnSitesResult} - 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 ListVpnSitesResult} 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); + } + } + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, vpnSiteName, vpnSiteParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates a VpnSite resource if it doesn't exist else updates the existing + * VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being created or + * updated. + * + * @param {object} vpnSiteParameters Parameters supplied to create or update + * VpnSite. + * + * @param {object} [vpnSiteParameters.virtualWAN] The VirtualWAN to which the + * vpnSite belongs + * + * @param {string} [vpnSiteParameters.virtualWAN.id] Resource ID. + * + * @param {object} [vpnSiteParameters.deviceProperties] The device properties + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceVendor] Name of + * the device Vendor. + * + * @param {string} [vpnSiteParameters.deviceProperties.deviceModel] Model of + * the device. + * + * @param {number} [vpnSiteParameters.deviceProperties.linkSpeedInMbps] Link + * speed. + * + * @param {string} [vpnSiteParameters.ipAddress] The ip-address for the + * vpn-site. + * + * @param {string} [vpnSiteParameters.siteKey] The key for vpn-site that can be + * used for connections. + * + * @param {object} [vpnSiteParameters.addressSpace] The AddressSpace that + * contains an array of IP address ranges. + * + * @param {array} [vpnSiteParameters.addressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [vpnSiteParameters.bgpProperties] The set of bgp properties. + * + * @param {number} [vpnSiteParameters.bgpProperties.asn] The BGP speaker's ASN. + * + * @param {string} [vpnSiteParameters.bgpProperties.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [vpnSiteParameters.bgpProperties.peerWeight] The weight + * added to routes learned from this BGP speaker. + * + * @param {string} [vpnSiteParameters.provisioningState] The provisioning state + * of the resource. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * + * @param {string} [vpnSiteParameters.id] Resource ID. + * + * @param {string} [vpnSiteParameters.location] Resource location. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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 VpnSite} 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. + */ + beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, 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._beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, vpnSiteName, vpnSiteParameters, options, optionalCallback); + } + } + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, vpnSiteName, vpnSiteParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates VpnSite tags. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being updated. + * + * @param {object} vpnSiteParameters Parameters supplied to update VpnSite + * tags. + * + * @param {object} [vpnSiteParameters.tags] Resource tags. + * + * @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 {VpnSite} - 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 VpnSite} 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. + */ + beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, 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._beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, vpnSiteName, vpnSiteParameters, options, optionalCallback); + } + } + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, vpnSiteName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, vpnSiteName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes a VpnSite. + * + * @param {string} resourceGroupName The resource group name of the VpnSite. + * + * @param {string} vpnSiteName The name of the VpnSite being deleted. + * + * @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. + */ + beginDeleteMethod(resourceGroupName, vpnSiteName, 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._beginDeleteMethod(resourceGroupName, vpnSiteName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, vpnSiteName, options, optionalCallback); + } + } + + /** + * Lists all the vpnSites in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, 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 vpnSites in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnSitesResult} - 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 ListVpnSitesResult} 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. + */ + listByResourceGroupNext(nextPageLink, 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._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all the VpnSites in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, 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 VpnSites in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @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 {ListVpnSitesResult} - 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 ListVpnSitesResult} 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. + */ + listNext(nextPageLink, 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._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VpnSites; diff --git a/lib/services/networkManagement2/lib/operations/vpnSitesConfiguration.js b/lib/services/networkManagement2/lib/operations/vpnSitesConfiguration.js new file mode 100644 index 0000000000..0569c61558 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/vpnSitesConfiguration.js @@ -0,0 +1,473 @@ +/* + * 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'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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 _download(resourceGroupName, virtualWANName, request, 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.beginDownload(resourceGroupName, virtualWANName, request, 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); + }); + }); +} + +/** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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 _beginDownload(resourceGroupName, virtualWANName, request, 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.'); + } + let apiVersion = '2018-04-01'; + // 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 (virtualWANName === null || virtualWANName === undefined || typeof virtualWANName.valueOf() !== 'string') { + throw new Error('virtualWANName cannot be null or undefined and it must be of type string.'); + } + if (request === null || request === undefined) { + throw new Error('request 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.Network/virtualWans/{virtualWANName}/vpnConfiguration'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualWANName}', encodeURIComponent(virtualWANName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(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 (request !== null && request !== undefined) { + let requestModelMapper = new client.models['GetVpnSitesConfigurationRequest']().mapper(); + requestModel = client.serialize(requestModelMapper, request, 'request'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(request, 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['ErrorModel']().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 VpnSitesConfiguration. */ +class VpnSitesConfiguration { + /** + * Create a VpnSitesConfiguration. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._download = _download; + this._beginDownload = _beginDownload; + } + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + downloadWithHttpOperationResponse(resourceGroupName, virtualWANName, request, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._download(resourceGroupName, virtualWANName, request, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + download(resourceGroupName, virtualWANName, request, 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._download(resourceGroupName, virtualWANName, request, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._download(resourceGroupName, virtualWANName, request, options, optionalCallback); + } + } + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + beginDownloadWithHttpOperationResponse(resourceGroupName, virtualWANName, request, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDownload(resourceGroupName, virtualWANName, request, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gives the sas-url to download the configurations for vpn-sites in a resource + * group. + * + * @param {string} resourceGroupName The resource group name. + * + * @param {string} virtualWANName The name of the VirtualWAN for which + * configuration of all vpn-sites is needed. + * + * @param {object} request Parameters supplied to download vpn-sites + * configuration. + * + * @param {array} [request.vpnSites] List of resource-ids of the vpn-sites for + * which config is to be downloaded. + * + * @param {string} [request.outputBlobSasUrl] The sas-url to download the + * configurations for vpn-sites + * + * @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. + */ + beginDownload(resourceGroupName, virtualWANName, request, 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._beginDownload(resourceGroupName, virtualWANName, request, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDownload(resourceGroupName, virtualWANName, request, options, optionalCallback); + } + } + +} + +module.exports = VpnSitesConfiguration;