From f468efc054f368b80bf6f095eb007e1db4e376c8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 8 Oct 2018 23:35:47 +0000 Subject: [PATCH] Generated from b232daf214b1a03e32b14427be20bbca4ac805ac ExpressRoutePort swagger --- .../lib/models/applicationGateway.js | 6 +- .../models/applicationGatewayCustomError.js | 2 +- .../models/applicationGatewayHttpListener.js | 6 +- .../lib/models/expressRouteCircuit.js | 30 + .../lib/models/expressRouteLink.js | 144 + .../lib/models/expressRouteLinkListResult.js | 68 + .../lib/models/expressRoutePort.js | 224 ++ .../lib/models/expressRoutePortListResult.js | 68 + .../lib/models/expressRoutePortsLocation.js | 140 + .../expressRoutePortsLocationBandwidths.js | 64 + .../expressRoutePortsLocationListResult.js | 68 + .../networkManagement2/lib/models/index.d.ts | 186 +- .../networkManagement2/lib/models/index.js | 7 + .../lib/networkManagementClient.d.ts | 3 + .../lib/networkManagementClient.js | 3 + .../lib/operations/applicationGateways.js | 12 +- .../lib/operations/expressRouteCircuits.js | 54 + .../lib/operations/expressRouteLinks.js | 727 +++++ .../lib/operations/expressRoutePorts.js | 2514 +++++++++++++++++ .../operations/expressRoutePortsLocations.js | 695 +++++ .../lib/operations/index.d.ts | 1201 +++++++- .../lib/operations/index.js | 3 + 22 files changed, 6203 insertions(+), 22 deletions(-) create mode 100644 lib/services/networkManagement2/lib/models/expressRouteLink.js create mode 100644 lib/services/networkManagement2/lib/models/expressRouteLinkListResult.js create mode 100644 lib/services/networkManagement2/lib/models/expressRoutePort.js create mode 100644 lib/services/networkManagement2/lib/models/expressRoutePortListResult.js create mode 100644 lib/services/networkManagement2/lib/models/expressRoutePortsLocation.js create mode 100644 lib/services/networkManagement2/lib/models/expressRoutePortsLocationBandwidths.js create mode 100644 lib/services/networkManagement2/lib/models/expressRoutePortsLocationListResult.js create mode 100644 lib/services/networkManagement2/lib/operations/expressRouteLinks.js create mode 100644 lib/services/networkManagement2/lib/operations/expressRoutePorts.js create mode 100644 lib/services/networkManagement2/lib/operations/expressRoutePortsLocations.js diff --git a/lib/services/networkManagement2/lib/models/applicationGateway.js b/lib/services/networkManagement2/lib/models/applicationGateway.js index a369ca4821..a375d3c5d6 100644 --- a/lib/services/networkManagement2/lib/models/applicationGateway.js +++ b/lib/services/networkManagement2/lib/models/applicationGateway.js @@ -107,7 +107,7 @@ class ApplicationGateway extends models['Resource'] { * @member {string} [provisioningState] Provisioning state of the application * gateway resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. - * @member {array} [customErrorConfiguration] Custom error configurations of + * @member {array} [customErrorConfigurations] Custom error configurations of * the application gateway resource. * @member {string} [etag] A unique read-only string that changes whenever * the resource is updated. @@ -439,9 +439,9 @@ class ApplicationGateway extends models['Resource'] { name: 'String' } }, - customErrorConfiguration: { + customErrorConfigurations: { required: false, - serializedName: 'properties.customErrorConfiguration', + serializedName: 'properties.customErrorConfigurations', type: { name: 'Sequence', element: { diff --git a/lib/services/networkManagement2/lib/models/applicationGatewayCustomError.js b/lib/services/networkManagement2/lib/models/applicationGatewayCustomError.js index 56b8ff1f91..99781e172e 100644 --- a/lib/services/networkManagement2/lib/models/applicationGatewayCustomError.js +++ b/lib/services/networkManagement2/lib/models/applicationGatewayCustomError.js @@ -18,7 +18,7 @@ class ApplicationGatewayCustomError { /** * Create a ApplicationGatewayCustomError. * @member {string} [statusCode] Status code of the application gateway - * customer error. Possible values include: '403', '502' + * customer error. Possible values include: 'HttpStatus403', 'HttpStatus502' * @member {string} [customErrorPageUrl] Error page URL of the application * gateway customer error. */ diff --git a/lib/services/networkManagement2/lib/models/applicationGatewayHttpListener.js b/lib/services/networkManagement2/lib/models/applicationGatewayHttpListener.js index 17b6862071..085411c204 100644 --- a/lib/services/networkManagement2/lib/models/applicationGatewayHttpListener.js +++ b/lib/services/networkManagement2/lib/models/applicationGatewayHttpListener.js @@ -37,7 +37,7 @@ class ApplicationGatewayHttpListener extends models['SubResource'] { * @member {string} [provisioningState] Provisioning state of the HTTP * listener resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. - * @member {array} [customErrorConfiguration] Custom error configurations of + * @member {array} [customErrorConfigurations] Custom error configurations of * the HTTP listener. * @member {string} [name] Name of the HTTP listener that is unique within an * Application Gateway. @@ -122,9 +122,9 @@ class ApplicationGatewayHttpListener extends models['SubResource'] { name: 'String' } }, - customErrorConfiguration: { + customErrorConfigurations: { required: false, - serializedName: 'properties.customErrorConfiguration', + serializedName: 'properties.customErrorConfigurations', type: { name: 'Sequence', element: { diff --git a/lib/services/networkManagement2/lib/models/expressRouteCircuit.js b/lib/services/networkManagement2/lib/models/expressRouteCircuit.js index a228a03b83..1c99d44dbe 100644 --- a/lib/services/networkManagement2/lib/models/expressRouteCircuit.js +++ b/lib/services/networkManagement2/lib/models/expressRouteCircuit.js @@ -47,6 +47,13 @@ class ExpressRouteCircuit extends models['Resource'] { * location. * @member {number} [serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. + * @member {object} [expressRoutePort] The reference to the ExpressRoutePort + * resource when the circuit is provisioned on an ExpressRoutePort resource. + * @member {string} [expressRoutePort.id] Resource ID. + * @member {number} [bandwidthInGbps] The bandwidth of the circuit when the + * circuit is provisioned on an ExpressRoutePort resource. + * @member {number} [stag] The identifier of the circuit traffic. Outer tag + * for QinQ encapsulation. * @member {string} [provisioningState] Gets the provisioning state of the * public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -199,6 +206,29 @@ class ExpressRouteCircuit extends models['Resource'] { className: 'ExpressRouteCircuitServiceProviderProperties' } }, + expressRoutePort: { + required: false, + serializedName: 'properties.expressRoutePort', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + bandwidthInGbps: { + required: false, + serializedName: 'properties.bandwidthInGbps', + type: { + name: 'Number' + } + }, + stag: { + required: false, + readOnly: true, + serializedName: 'properties.stag', + type: { + name: 'Number' + } + }, provisioningState: { required: false, serializedName: 'properties.provisioningState', diff --git a/lib/services/networkManagement2/lib/models/expressRouteLink.js b/lib/services/networkManagement2/lib/models/expressRouteLink.js new file mode 100644 index 0000000000..0311621c4d --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRouteLink.js @@ -0,0 +1,144 @@ +/* + * 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'); + +/** + * @summary ExpressRouteLink + * + * ExpressRouteLink child resource definition. + * + * @extends models['SubResource'] + */ +class ExpressRouteLink extends models['SubResource'] { + /** + * Create a ExpressRouteLink. + * @member {string} [routerName] Name of Azure router associated with + * physical port. + * @member {string} [interfaceName] Name of Azure router interface. + * @member {string} [patchPanelId] Mapping between physical port to patch + * panel port. + * @member {string} [rackId] Mapping of physical patch panel to rack. + * @member {string} [connectorType] Physical fiber port type. Possible values + * include: 'LC', 'SC' + * @member {string} [adminState] Administrative state of the physical port. + * Possible values include: 'Enabled', 'Disabled' + * @member {string} [provisioningState] The provisioning state of the + * ExpressRouteLink resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Name of child port resource that is unique among + * child port resources of the parent. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteLink + * + * @returns {object} metadata of ExpressRouteLink + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteLink', + type: { + name: 'Composite', + className: 'ExpressRouteLink', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + routerName: { + required: false, + readOnly: true, + serializedName: 'properties.routerName', + type: { + name: 'String' + } + }, + interfaceName: { + required: false, + readOnly: true, + serializedName: 'properties.interfaceName', + type: { + name: 'String' + } + }, + patchPanelId: { + required: false, + readOnly: true, + serializedName: 'properties.patchPanelId', + type: { + name: 'String' + } + }, + rackId: { + required: false, + readOnly: true, + serializedName: 'properties.rackId', + type: { + name: 'String' + } + }, + connectorType: { + required: false, + readOnly: true, + serializedName: 'properties.connectorType', + type: { + name: 'String' + } + }, + adminState: { + required: false, + serializedName: 'properties.adminState', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteLink; diff --git a/lib/services/networkManagement2/lib/models/expressRouteLinkListResult.js b/lib/services/networkManagement2/lib/models/expressRouteLinkListResult.js new file mode 100644 index 0000000000..178bd4ed00 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRouteLinkListResult.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'; + +/** + * @summary ExpressRouteLink List Result + * Response for ListExpressRouteLinks API service call. + */ +class ExpressRouteLinkListResult extends Array { + /** + * Create a ExpressRouteLinkListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteLinkListResult + * + * @returns {object} metadata of ExpressRouteLinkListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteLinkListResult', + type: { + name: 'Composite', + className: 'ExpressRouteLinkListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteLinkElementType', + type: { + name: 'Composite', + className: 'ExpressRouteLink' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteLinkListResult; diff --git a/lib/services/networkManagement2/lib/models/expressRoutePort.js b/lib/services/networkManagement2/lib/models/expressRoutePort.js new file mode 100644 index 0000000000..46ace40229 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRoutePort.js @@ -0,0 +1,224 @@ +/* + * 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'); + +/** + * @summary ExpressRoute Port + * + * ExpressRoutePort resource definition. + * + * @extends models['Resource'] + */ +class ExpressRoutePort extends models['Resource'] { + /** + * Create a ExpressRoutePort. + * @member {string} [peeringLocation] The name of the peering location that + * the ExpressRoutePort is mapped to physically. + * @member {number} [bandwidthInGbps] Bandwidth of procured ports in Gbps + * @member {number} [provisionedBandwidthInGbps] Aggregate Gbps of associated + * circuit bandwidths. + * @member {string} [mtu] Maximum transmission unit of the physical port + * pair(s) + * @member {string} [encapsulation] Encapsulation method on physical ports. + * Possible values include: 'Dot1Q', 'QinQ' + * @member {string} [etherType] Ethertype of the physical port. + * @member {string} [allocationDate] Date of the physical port allocation to + * be used in Letter of Authorization. + * @member {array} [links] ExpressRouteLink Sub-Resources. The set of + * physical links of the ExpressRoutePort resource + * @member {array} [circuits] Reference the ExpressRoute circuit(s) that are + * provisioned on this ExpressRoutePort resource. + * @member {string} [provisioningState] The provisioning state of the + * ExpressRoutePort resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRoutePort + * + * @returns {object} metadata of ExpressRoutePort + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRoutePort', + type: { + name: 'Composite', + className: 'ExpressRoutePort', + 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' + } + } + } + }, + peeringLocation: { + required: false, + serializedName: 'properties.peeringLocation', + type: { + name: 'String' + } + }, + bandwidthInGbps: { + required: false, + serializedName: 'properties.bandwidthInGbps', + type: { + name: 'Number' + } + }, + provisionedBandwidthInGbps: { + required: false, + readOnly: true, + serializedName: 'properties.provisionedBandwidthInGbps', + type: { + name: 'Number' + } + }, + mtu: { + required: false, + readOnly: true, + serializedName: 'properties.mtu', + type: { + name: 'String' + } + }, + encapsulation: { + required: false, + serializedName: 'properties.encapsulation', + type: { + name: 'String' + } + }, + etherType: { + required: false, + readOnly: true, + serializedName: 'properties.etherType', + type: { + name: 'String' + } + }, + allocationDate: { + required: false, + readOnly: true, + serializedName: 'properties.allocationDate', + type: { + name: 'String' + } + }, + links: { + required: false, + serializedName: 'properties.links', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteLinkElementType', + type: { + name: 'Composite', + className: 'ExpressRouteLink' + } + } + } + }, + circuits: { + required: false, + readOnly: true, + serializedName: 'properties.circuits', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRoutePort; diff --git a/lib/services/networkManagement2/lib/models/expressRoutePortListResult.js b/lib/services/networkManagement2/lib/models/expressRoutePortListResult.js new file mode 100644 index 0000000000..c4ad9707fb --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRoutePortListResult.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'; + +/** + * @summary ExpressRoute Port List Result + * Response for ListExpressRoutePorts API service call. + */ +class ExpressRoutePortListResult extends Array { + /** + * Create a ExpressRoutePortListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRoutePortListResult + * + * @returns {object} metadata of ExpressRoutePortListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRoutePortListResult', + type: { + name: 'Composite', + className: 'ExpressRoutePortListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRoutePortElementType', + type: { + name: 'Composite', + className: 'ExpressRoutePort' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRoutePortListResult; diff --git a/lib/services/networkManagement2/lib/models/expressRoutePortsLocation.js b/lib/services/networkManagement2/lib/models/expressRoutePortsLocation.js new file mode 100644 index 0000000000..a49e41befc --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRoutePortsLocation.js @@ -0,0 +1,140 @@ +/* + * 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'); + +/** + * @summary ExpressRoutePorts Peering Location + * + * Definition of the ExpressRoutePorts peering location resource. + * + * @extends models['Resource'] + */ +class ExpressRoutePortsLocation extends models['Resource'] { + /** + * Create a ExpressRoutePortsLocation. + * @member {string} [address] Address of peering location. + * @member {string} [contact] Contact details of peering locations. + * @member {array} [availableBandwidths] The inventory of available + * ExpressRoutePort bandwidths. + * @member {string} [provisioningState] The provisioning state of the + * ExpressRoutePortLocation resource. Possible values are: 'Succeeded', + * 'Updating', 'Deleting', and 'Failed'. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRoutePortsLocation + * + * @returns {object} metadata of ExpressRoutePortsLocation + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRoutePortsLocation', + type: { + name: 'Composite', + className: 'ExpressRoutePortsLocation', + 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' + } + } + } + }, + address: { + required: false, + readOnly: true, + serializedName: 'properties.address', + type: { + name: 'String' + } + }, + contact: { + required: false, + readOnly: true, + serializedName: 'properties.contact', + type: { + name: 'String' + } + }, + availableBandwidths: { + required: false, + serializedName: 'properties.availableBandwidths', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRoutePortsLocationBandwidthsElementType', + type: { + name: 'Composite', + className: 'ExpressRoutePortsLocationBandwidths' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRoutePortsLocation; diff --git a/lib/services/networkManagement2/lib/models/expressRoutePortsLocationBandwidths.js b/lib/services/networkManagement2/lib/models/expressRoutePortsLocationBandwidths.js new file mode 100644 index 0000000000..fa3078f127 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRoutePortsLocationBandwidths.js @@ -0,0 +1,64 @@ +/* + * 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'; + +/** + * @summary ExpressRoutePorts Location Bandwidths + * + * Real-time inventory of available ExpressRoute port bandwidths. + * + */ +class ExpressRoutePortsLocationBandwidths { + /** + * Create a ExpressRoutePortsLocationBandwidths. + * @member {string} [offerName] Bandwidth descriptive name + * @member {number} [valueInGbps] Bandwidth value in Gbps + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRoutePortsLocationBandwidths + * + * @returns {object} metadata of ExpressRoutePortsLocationBandwidths + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRoutePortsLocationBandwidths', + type: { + name: 'Composite', + className: 'ExpressRoutePortsLocationBandwidths', + modelProperties: { + offerName: { + required: false, + readOnly: true, + serializedName: 'offerName', + type: { + name: 'String' + } + }, + valueInGbps: { + required: false, + readOnly: true, + serializedName: 'valueInGbps', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ExpressRoutePortsLocationBandwidths; diff --git a/lib/services/networkManagement2/lib/models/expressRoutePortsLocationListResult.js b/lib/services/networkManagement2/lib/models/expressRoutePortsLocationListResult.js new file mode 100644 index 0000000000..4cb4f4d510 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/expressRoutePortsLocationListResult.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'; + +/** + * @summary ExpressRoutePorts Location List Result + * Response for ListExpressRoutePortsLocations API service call. + */ +class ExpressRoutePortsLocationListResult extends Array { + /** + * Create a ExpressRoutePortsLocationListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRoutePortsLocationListResult + * + * @returns {object} metadata of ExpressRoutePortsLocationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRoutePortsLocationListResult', + type: { + name: 'Composite', + className: 'ExpressRoutePortsLocationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRoutePortsLocationElementType', + type: { + name: 'Composite', + className: 'ExpressRoutePortsLocation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRoutePortsLocationListResult; diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index 2e53b111ef..b0a06b539b 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -4072,7 +4072,7 @@ export interface ApplicationGatewayFrontendPort extends SubResource { * Customer error of an application gateway. * * @member {string} [statusCode] Status code of the application gateway - * customer error. Possible values include: '403', '502' + * customer error. Possible values include: 'HttpStatus403', 'HttpStatus502' * @member {string} [customErrorPageUrl] Error page URL of the application * gateway customer error. */ @@ -4103,7 +4103,7 @@ export interface ApplicationGatewayCustomError { * is https. Enables SNI for multi-hosting. * @member {string} [provisioningState] Provisioning state of the HTTP listener * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. - * @member {array} [customErrorConfiguration] Custom error configurations of + * @member {array} [customErrorConfigurations] Custom error configurations of * the HTTP listener. * @member {string} [name] Name of the HTTP listener that is unique within an * Application Gateway. @@ -4119,7 +4119,7 @@ export interface ApplicationGatewayHttpListener extends SubResource { sslCertificate?: SubResource; requireServerNameIndication?: boolean; provisioningState?: string; - customErrorConfiguration?: ApplicationGatewayCustomError[]; + customErrorConfigurations?: ApplicationGatewayCustomError[]; name?: string; etag?: string; type?: string; @@ -4528,7 +4528,7 @@ export interface ApplicationGatewayAutoscaleConfiguration { * gateway resource. * @member {string} [provisioningState] Provisioning state of the application * gateway resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. - * @member {array} [customErrorConfiguration] Custom error configurations of + * @member {array} [customErrorConfigurations] Custom error configurations of * the application gateway resource. * @member {string} [etag] A unique read-only string that changes whenever the * resource is updated. @@ -4558,7 +4558,7 @@ export interface ApplicationGateway extends Resource { autoscaleConfiguration?: ApplicationGatewayAutoscaleConfiguration; resourceGuid?: string; provisioningState?: string; - customErrorConfiguration?: ApplicationGatewayCustomError[]; + customErrorConfigurations?: ApplicationGatewayCustomError[]; etag?: string; zones?: string[]; } @@ -5455,6 +5455,13 @@ export interface ExpressRouteCircuitServiceProviderProperties { * location. * @member {number} [serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. + * @member {object} [expressRoutePort] The reference to the ExpressRoutePort + * resource when the circuit is provisioned on an ExpressRoutePort resource. + * @member {string} [expressRoutePort.id] Resource ID. + * @member {number} [bandwidthInGbps] The bandwidth of the circuit when the + * circuit is provisioned on an ExpressRoutePort resource. + * @member {number} [stag] The identifier of the circuit traffic. Outer tag for + * QinQ encapsulation. * @member {string} [provisioningState] Gets the provisioning state of the * public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -5474,6 +5481,9 @@ export interface ExpressRouteCircuit extends Resource { serviceKey?: string; serviceProviderNotes?: string; serviceProviderProperties?: ExpressRouteCircuitServiceProviderProperties; + expressRoutePort?: SubResource; + bandwidthInGbps?: number; + readonly stag?: number; provisioningState?: string; gatewayManagerEtag?: string; allowGlobalReach?: boolean; @@ -5952,6 +5962,130 @@ export interface ExpressRouteConnectionList { value?: ExpressRouteConnection[]; } +/** + * @class + * Initializes a new instance of the ExpressRoutePortsLocationBandwidths class. + * @constructor + * @summary ExpressRoutePorts Location Bandwidths + * + * Real-time inventory of available ExpressRoute port bandwidths. + * + * @member {string} [offerName] Bandwidth descriptive name + * @member {number} [valueInGbps] Bandwidth value in Gbps + */ +export interface ExpressRoutePortsLocationBandwidths { + readonly offerName?: string; + readonly valueInGbps?: number; +} + +/** + * @class + * Initializes a new instance of the ExpressRoutePortsLocation class. + * @constructor + * @summary ExpressRoutePorts Peering Location + * + * Definition of the ExpressRoutePorts peering location resource. + * + * @member {string} [address] Address of peering location. + * @member {string} [contact] Contact details of peering locations. + * @member {array} [availableBandwidths] The inventory of available + * ExpressRoutePort bandwidths. + * @member {string} [provisioningState] The provisioning state of the + * ExpressRoutePortLocation resource. Possible values are: 'Succeeded', + * 'Updating', 'Deleting', and 'Failed'. + */ +export interface ExpressRoutePortsLocation extends Resource { + readonly address?: string; + readonly contact?: string; + availableBandwidths?: ExpressRoutePortsLocationBandwidths[]; + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteLink class. + * @constructor + * @summary ExpressRouteLink + * + * ExpressRouteLink child resource definition. + * + * @member {string} [routerName] Name of Azure router associated with physical + * port. + * @member {string} [interfaceName] Name of Azure router interface. + * @member {string} [patchPanelId] Mapping between physical port to patch panel + * port. + * @member {string} [rackId] Mapping of physical patch panel to rack. + * @member {string} [connectorType] Physical fiber port type. Possible values + * include: 'LC', 'SC' + * @member {string} [adminState] Administrative state of the physical port. + * Possible values include: 'Enabled', 'Disabled' + * @member {string} [provisioningState] The provisioning state of the + * ExpressRouteLink resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Name of child port resource that is unique among + * child port resources of the parent. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRouteLink extends SubResource { + readonly routerName?: string; + readonly interfaceName?: string; + readonly patchPanelId?: string; + readonly rackId?: string; + readonly connectorType?: string; + adminState?: string; + readonly provisioningState?: string; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRoutePort class. + * @constructor + * @summary ExpressRoute Port + * + * ExpressRoutePort resource definition. + * + * @member {string} [peeringLocation] The name of the peering location that the + * ExpressRoutePort is mapped to physically. + * @member {number} [bandwidthInGbps] Bandwidth of procured ports in Gbps + * @member {number} [provisionedBandwidthInGbps] Aggregate Gbps of associated + * circuit bandwidths. + * @member {string} [mtu] Maximum transmission unit of the physical port + * pair(s) + * @member {string} [encapsulation] Encapsulation method on physical ports. + * Possible values include: 'Dot1Q', 'QinQ' + * @member {string} [etherType] Ethertype of the physical port. + * @member {string} [allocationDate] Date of the physical port allocation to be + * used in Letter of Authorization. + * @member {array} [links] ExpressRouteLink Sub-Resources. The set of physical + * links of the ExpressRoutePort resource + * @member {array} [circuits] Reference the ExpressRoute circuit(s) that are + * provisioned on this ExpressRoutePort resource. + * @member {string} [provisioningState] The provisioning state of the + * ExpressRoutePort resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRoutePort extends Resource { + peeringLocation?: string; + bandwidthInGbps?: number; + readonly provisionedBandwidthInGbps?: number; + readonly mtu?: string; + encapsulation?: string; + readonly etherType?: string; + readonly allocationDate?: string; + links?: ExpressRouteLink[]; + readonly circuits?: SubResource[]; + readonly provisioningState?: string; + resourceGuid?: string; + readonly etag?: string; +} + /** * @class * Initializes a new instance of the LoadBalancerSku class. @@ -10097,6 +10231,48 @@ export interface ExpressRouteCrossConnectionPeeringList extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRoutePortListResult class. + * @constructor + * @summary ExpressRoute Port List Result + * + * Response for ListExpressRoutePorts API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRoutePortListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteLinkListResult class. + * @constructor + * @summary ExpressRouteLink List Result + * + * Response for ListExpressRouteLinks API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteLinkListResult extends Array { + nextLink?: string; +} + /** * @class * Initializes a new instance of the InterfaceEndpointListResult class. diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index 2f80e87933..996ed19f35 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -133,6 +133,10 @@ exports.ExpressRouteConnection = require('./expressRouteConnection'); exports.ExpressRouteGateway = require('./expressRouteGateway'); exports.ExpressRouteGatewayList = require('./expressRouteGatewayList'); exports.ExpressRouteConnectionList = require('./expressRouteConnectionList'); +exports.ExpressRoutePortsLocationBandwidths = require('./expressRoutePortsLocationBandwidths'); +exports.ExpressRoutePortsLocation = require('./expressRoutePortsLocation'); +exports.ExpressRouteLink = require('./expressRouteLink'); +exports.ExpressRoutePort = require('./expressRoutePort'); exports.LoadBalancerSku = require('./loadBalancerSku'); exports.LoadBalancingRule = require('./loadBalancingRule'); exports.Probe = require('./probe'); @@ -300,6 +304,9 @@ exports.ExpressRouteCircuitListResult = require('./expressRouteCircuitListResult exports.ExpressRouteServiceProviderListResult = require('./expressRouteServiceProviderListResult'); exports.ExpressRouteCrossConnectionListResult = require('./expressRouteCrossConnectionListResult'); exports.ExpressRouteCrossConnectionPeeringList = require('./expressRouteCrossConnectionPeeringList'); +exports.ExpressRoutePortsLocationListResult = require('./expressRoutePortsLocationListResult'); +exports.ExpressRoutePortListResult = require('./expressRoutePortListResult'); +exports.ExpressRouteLinkListResult = require('./expressRouteLinkListResult'); exports.InterfaceEndpointListResult = require('./interfaceEndpointListResult'); exports.LoadBalancerListResult = require('./loadBalancerListResult'); exports.LoadBalancerBackendAddressPoolListResult = require('./loadBalancerBackendAddressPoolListResult'); diff --git a/lib/services/networkManagement2/lib/networkManagementClient.d.ts b/lib/services/networkManagement2/lib/networkManagementClient.d.ts index 24d6e3597b..db8221d87c 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.d.ts +++ b/lib/services/networkManagement2/lib/networkManagementClient.d.ts @@ -71,6 +71,9 @@ export default class NetworkManagementClient extends AzureServiceClient { expressRouteCrossConnectionPeerings: operations.ExpressRouteCrossConnectionPeerings; expressRouteGateways: operations.ExpressRouteGateways; expressRouteConnections: operations.ExpressRouteConnections; + expressRoutePortsLocations: operations.ExpressRoutePortsLocations; + expressRoutePorts: operations.ExpressRoutePorts; + expressRouteLinks: operations.ExpressRouteLinks; interfaceEndpoints: operations.InterfaceEndpoints; loadBalancers: operations.LoadBalancers; loadBalancerBackendAddressPools: operations.LoadBalancerBackendAddressPools; diff --git a/lib/services/networkManagement2/lib/networkManagementClient.js b/lib/services/networkManagement2/lib/networkManagementClient.js index 1eaf2d3bc3..93d6d0dbff 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.js +++ b/lib/services/networkManagement2/lib/networkManagementClient.js @@ -381,6 +381,9 @@ class NetworkManagementClient extends ServiceClient { this.expressRouteCrossConnectionPeerings = new operations.ExpressRouteCrossConnectionPeerings(this); this.expressRouteGateways = new operations.ExpressRouteGateways(this); this.expressRouteConnections = new operations.ExpressRouteConnections(this); + this.expressRoutePortsLocations = new operations.ExpressRoutePortsLocations(this); + this.expressRoutePorts = new operations.ExpressRoutePorts(this); + this.expressRouteLinks = new operations.ExpressRouteLinks(this); this.interfaceEndpoints = new operations.InterfaceEndpoints(this); this.loadBalancers = new operations.LoadBalancers(this); this.loadBalancerBackendAddressPools = new operations.LoadBalancerBackendAddressPools(this); diff --git a/lib/services/networkManagement2/lib/operations/applicationGateways.js b/lib/services/networkManagement2/lib/operations/applicationGateways.js index a0d560e9e9..a6b9b9c2c3 100644 --- a/lib/services/networkManagement2/lib/operations/applicationGateways.js +++ b/lib/services/networkManagement2/lib/operations/applicationGateways.js @@ -361,7 +361,7 @@ function _get(resourceGroupName, applicationGatewayName, options, callback) { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -1809,7 +1809,7 @@ function _beginDeleteMethod(resourceGroupName, applicationGatewayName, options, * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -3292,7 +3292,7 @@ class ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -3472,7 +3472,7 @@ class ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -4604,7 +4604,7 @@ class ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -4784,7 +4784,7 @@ class ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes diff --git a/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js b/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js index d3622cf009..9b2382f894 100644 --- a/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js +++ b/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js @@ -274,6 +274,15 @@ function _get(resourceGroupName, circuitName, options, callback) { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -1437,6 +1446,15 @@ function _beginDeleteMethod(resourceGroupName, circuitName, options, callback) { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -2768,6 +2786,15 @@ class ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -2861,6 +2888,15 @@ class ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -3789,6 +3825,15 @@ class ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -3882,6 +3927,15 @@ class ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. diff --git a/lib/services/networkManagement2/lib/operations/expressRouteLinks.js b/lib/services/networkManagement2/lib/operations/expressRouteLinks.js new file mode 100644 index 0000000000..49202bd2ce --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/expressRouteLinks.js @@ -0,0 +1,727 @@ +/* + * 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 specified ExpressRouteLink resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {string} linkName The name of the ExpressRouteLink resource. + * + * @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 ExpressRouteLink} 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, expressRoutePortName, linkName, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName cannot be null or undefined and it must be of type string.'); + } + if (linkName === null || linkName === undefined || typeof linkName.valueOf() !== 'string') { + throw new Error('linkName 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/ExpressRoutePorts/{expressRoutePortName}/links/{linkName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + requestUrl = requestUrl.replace('{linkName}', encodeURIComponent(linkName)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteLink']().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); + }); +} + +/** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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 ExpressRouteLinkListResult} 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, expressRoutePortName, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName 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/ExpressRoutePorts/{expressRoutePortName}/links'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteLinkListResult']().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); + }); +} + +/** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @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 ExpressRouteLinkListResult} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteLinkListResult']().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 ExpressRouteLinks. */ +class ExpressRouteLinks { + /** + * Create a ExpressRouteLinks. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._get = _get; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Retrieves the specified ExpressRouteLink resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {string} linkName The name of the ExpressRouteLink resource. + * + * @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, expressRoutePortName, linkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, expressRoutePortName, linkName, 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 specified ExpressRouteLink resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {string} linkName The name of the ExpressRouteLink resource. + * + * @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 {ExpressRouteLink} - 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 ExpressRouteLink} 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, expressRoutePortName, linkName, 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, expressRoutePortName, linkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, expressRoutePortName, linkName, options, optionalCallback); + } + } + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, expressRoutePortName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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 {ExpressRouteLinkListResult} - 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 ExpressRouteLinkListResult} 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, expressRoutePortName, 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, expressRoutePortName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, expressRoutePortName, options, optionalCallback); + } + } + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @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; + }); + }); + } + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @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 {ExpressRouteLinkListResult} - 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 ExpressRouteLinkListResult} 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 = ExpressRouteLinks; diff --git a/lib/services/networkManagement2/lib/operations/expressRoutePorts.js b/lib/services/networkManagement2/lib/operations/expressRoutePorts.js new file mode 100644 index 0000000000..f8d545888c --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/expressRoutePorts.js @@ -0,0 +1,2514 @@ +/* + * 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; + + +/** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, 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, expressRoutePortName, 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 the requested ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of ExpressRoutePort. + * + * @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 ExpressRoutePort} 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, expressRoutePortName, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName 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/ExpressRoutePorts/{expressRoutePortName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePort']().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 or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, 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['ExpressRoutePort']().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); + }); + }); +} + + +/** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, 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['ExpressRoutePort']().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); + }); + }); +} + +/** + * List all the ExpressRoutePort resources in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 ExpressRoutePortListResult} 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-08-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/ExpressRoutePorts'; + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortListResult']().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); + }); +} + +/** + * List all the ExpressRoutePort resources in the specified 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 ExpressRoutePortListResult} 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-08-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/ExpressRoutePorts'; + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortListResult']().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 the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName 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/ExpressRoutePorts/{expressRoutePortName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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/ExpressRoutePorts/{expressRoutePortName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ExpressRoutePort']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePort']().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['ExpressRoutePort']().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); + }); +} + +/** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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-08-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 (expressRoutePortName === null || expressRoutePortName === undefined || typeof expressRoutePortName.valueOf() !== 'string') { + throw new Error('expressRoutePortName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters 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/ExpressRoutePorts/{expressRoutePortName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{expressRoutePortName}', encodeURIComponent(expressRoutePortName)); + 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 (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, 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) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePort']().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); + }); +} + +/** + * List all the ExpressRoutePort resources in the specified 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 ExpressRoutePortListResult} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortListResult']().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); + }); +} + +/** + * List all the ExpressRoutePort resources in the specified 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 ExpressRoutePortListResult} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortListResult']().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 ExpressRoutePorts. */ +class ExpressRoutePorts { + /** + * Create a ExpressRoutePorts. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, expressRoutePortName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, 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, expressRoutePortName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, expressRoutePortName, options, optionalCallback); + } + } + + /** + * Retrieves the requested ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of ExpressRoutePort. + * + * @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, expressRoutePortName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, expressRoutePortName, 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 requested ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of ExpressRoutePort. + * + * @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 {ExpressRoutePort} - 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 ExpressRoutePort} 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, expressRoutePortName, 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, expressRoutePortName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, expressRoutePortName, options, optionalCallback); + } + } + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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, expressRoutePortName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, expressRoutePortName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, expressRoutePortName, parameters, options, optionalCallback); + } + } + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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, expressRoutePortName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, expressRoutePortName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, expressRoutePortName, parameters, options, optionalCallback); + } + } + + /** + * List all the ExpressRoutePort resources in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all the ExpressRoutePort resources in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRoutePortListResult} - 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 ExpressRoutePortListResult} 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); + } + } + + /** + * List all the ExpressRoutePort resources in the specified 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; + }); + }); + } + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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 ExpressRoutePortListResult} 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); + } + } + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, expressRoutePortName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName, 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, expressRoutePortName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, expressRoutePortName, options, optionalCallback); + } + } + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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, expressRoutePortName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, expressRoutePortName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, expressRoutePortName, parameters, options, optionalCallback); + } + } + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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, expressRoutePortName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, expressRoutePortName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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 ExpressRoutePort} 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, expressRoutePortName, parameters, 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, expressRoutePortName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, expressRoutePortName, parameters, options, optionalCallback); + } + } + + /** + * List all the ExpressRoutePort resources in the specified 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; + }); + }); + } + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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 ExpressRoutePortListResult} 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); + } + } + + /** + * List all the ExpressRoutePort resources in the specified 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; + }); + }); + } + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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 ExpressRoutePortListResult} 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 = ExpressRoutePorts; diff --git a/lib/services/networkManagement2/lib/operations/expressRoutePortsLocations.js b/lib/services/networkManagement2/lib/operations/expressRoutePortsLocations.js new file mode 100644 index 0000000000..f84b4bde25 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/expressRoutePortsLocations.js @@ -0,0 +1,695 @@ +/* + * 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 all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 ExpressRoutePortsLocationListResult} 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-08-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/ExpressRoutePortsLocations'; + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortsLocationListResult']().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 a single ExpressRoutePort peering location, including the list of + * available bandwidths available at said peering location. + * + * @param {string} locationName Name of the requested ExpressRoutePort peering + * location. + * + * @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 ExpressRoutePortsLocation} 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(locationName, 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-08-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 (locationName === null || locationName === undefined || typeof locationName.valueOf() !== 'string') { + throw new Error('locationName 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/ExpressRoutePortsLocations/{locationName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{locationName}', encodeURIComponent(locationName)); + 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortsLocation']().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 all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 ExpressRoutePortsLocationListResult} 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) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRoutePortsLocationListResult']().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 ExpressRoutePortsLocations. */ +class ExpressRoutePortsLocations { + /** + * Create a ExpressRoutePortsLocations. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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; + }); + }); + } + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 {ExpressRoutePortsLocationListResult} - 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 ExpressRoutePortsLocationListResult} 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); + } + } + + /** + * Retrieves a single ExpressRoutePort peering location, including the list of + * available bandwidths available at said peering location. + * + * @param {string} locationName Name of the requested ExpressRoutePort peering + * location. + * + * @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(locationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(locationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves a single ExpressRoutePort peering location, including the list of + * available bandwidths available at said peering location. + * + * @param {string} locationName Name of the requested ExpressRoutePort peering + * location. + * + * @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 {ExpressRoutePortsLocation} - 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 ExpressRoutePortsLocation} 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(locationName, 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(locationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(locationName, options, optionalCallback); + } + } + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 {ExpressRoutePortsLocationListResult} - 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 ExpressRoutePortsLocationListResult} 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 = ExpressRoutePortsLocations; diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index b77d8f842c..50d1f6586d 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -278,7 +278,7 @@ export interface ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -446,7 +446,7 @@ export interface ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -1266,7 +1266,7 @@ export interface ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -1434,7 +1434,7 @@ export interface ApplicationGateways { * application gateway resource. Possible values are: 'Updating', 'Deleting', * and 'Failed'. * - * @param {array} [parameters.customErrorConfiguration] Custom error + * @param {array} [parameters.customErrorConfigurations] Custom error * configurations of the application gateway resource. * * @param {string} [parameters.etag] A unique read-only string that changes @@ -6326,6 +6326,15 @@ export interface ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -6407,6 +6416,15 @@ export interface ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -7077,6 +7095,15 @@ export interface ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -7158,6 +7185,15 @@ export interface ExpressRouteCircuits { * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The * BandwidthInMbps. * + * @param {object} [parameters.expressRoutePort] The reference to the + * ExpressRoutePort resource when the circuit is provisioned on an + * ExpressRoutePort resource. + * + * @param {string} [parameters.expressRoutePort.id] Resource ID. + * + * @param {number} [parameters.bandwidthInGbps] The bandwidth of the circuit + * when the circuit is provisioned on an ExpressRoutePort resource. + * * @param {string} [parameters.provisioningState] Gets the provisioning state * of the public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -10739,6 +10775,1163 @@ export interface ExpressRouteConnections { beginDeleteMethod(resourceGroupName: string, expressRouteGatewayName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * ExpressRoutePortsLocations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRoutePortsLocations { + + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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>; + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 {ExpressRoutePortsLocationListResult} - 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. + * + * {ExpressRoutePortsLocationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortsLocationListResult} 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; + + + /** + * Retrieves a single ExpressRoutePort peering location, including the list of + * available bandwidths available at said peering location. + * + * @param {string} locationName Name of the requested ExpressRoutePort peering + * location. + * + * @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(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves a single ExpressRoutePort peering location, including the list of + * available bandwidths available at said peering location. + * + * @param {string} locationName Name of the requested ExpressRoutePort peering + * location. + * + * @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 {ExpressRoutePortsLocation} - 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. + * + * {ExpressRoutePortsLocation} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortsLocation} 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(locationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(locationName: string, callback: ServiceCallback): void; + get(locationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 all ExpressRoutePort peering locations. Does not return available + * bandwidths for each location. Available bandwidths can only be obtained when + * retriving a specific peering location. + * + * @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 {ExpressRoutePortsLocationListResult} - 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. + * + * {ExpressRoutePortsLocationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortsLocationListResult} 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 + * ExpressRoutePorts + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRoutePorts { + + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, expressRoutePortName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, expressRoutePortName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves the requested ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of ExpressRoutePort. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the requested ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of ExpressRoutePort. + * + * @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 {ExpressRoutePort} - 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. + * + * {ExpressRoutePort} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePort} 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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, expressRoutePortName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, expressRoutePortName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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, expressRoutePortName: string, parameters: models.ExpressRoutePort, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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. + * + * {ExpressRoutePort} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePort} 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, expressRoutePortName: string, parameters: models.ExpressRoutePort, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, expressRoutePortName: string, parameters: models.ExpressRoutePort, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, expressRoutePortName: string, parameters: models.ExpressRoutePort, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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, expressRoutePortName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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. + * + * {ExpressRoutePort} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePort} 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, expressRoutePortName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, expressRoutePortName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, expressRoutePortName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all the ExpressRoutePort resources in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all the ExpressRoutePort resources in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @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 {ExpressRoutePortListResult} - 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. + * + * {ExpressRoutePortListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortListResult} 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; + + + /** + * List all the ExpressRoutePort resources in the specified 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>; + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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. + * + * {ExpressRoutePortListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortListResult} 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; + + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, expressRoutePortName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, expressRoutePortName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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, expressRoutePortName: string, parameters: models.ExpressRoutePort, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the specified ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to the create + * ExpressRoutePort operation. + * + * @param {string} [parameters.peeringLocation] The name of the peering + * location that the ExpressRoutePort is mapped to physically. + * + * @param {number} [parameters.bandwidthInGbps] Bandwidth of procured ports in + * Gbps + * + * @param {string} [parameters.encapsulation] Encapsulation method on physical + * ports. Possible values include: 'Dot1Q', 'QinQ' + * + * @param {array} [parameters.links] ExpressRouteLink Sub-Resources The set of + * physical links of the ExpressRoutePort resource + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * ExpressRoutePort resource. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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. + * + * {ExpressRoutePort} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePort} 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, expressRoutePortName: string, parameters: models.ExpressRoutePort, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, expressRoutePortName: string, parameters: models.ExpressRoutePort, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, expressRoutePortName: string, parameters: models.ExpressRoutePort, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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, expressRoutePortName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update ExpressRoutePort tags + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {object} parameters Parameters supplied to update ExpressRoutePort + * resource tags. + * + * @param {object} [parameters.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 {ExpressRoutePort} - 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. + * + * {ExpressRoutePort} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePort} 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, expressRoutePortName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, expressRoutePortName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, expressRoutePortName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all the ExpressRoutePort resources in the specified 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>; + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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. + * + * {ExpressRoutePortListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortListResult} 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; + + + /** + * List all the ExpressRoutePort resources in the specified 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>; + + /** + * List all the ExpressRoutePort resources in the specified 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 {ExpressRoutePortListResult} - 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. + * + * {ExpressRoutePortListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRoutePortListResult} 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 + * ExpressRouteLinks + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteLinks { + + + /** + * Retrieves the specified ExpressRouteLink resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {string} linkName The name of the ExpressRouteLink resource. + * + * @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, expressRoutePortName: string, linkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves the specified ExpressRouteLink resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @param {string} linkName The name of the ExpressRouteLink resource. + * + * @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 {ExpressRouteLink} - 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. + * + * {ExpressRouteLink} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteLink} 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, expressRoutePortName: string, linkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, expressRoutePortName: string, linkName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, expressRoutePortName: string, linkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} expressRoutePortName The name of the ExpressRoutePort + * resource. + * + * @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 {ExpressRouteLinkListResult} - 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. + * + * {ExpressRouteLinkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteLinkListResult} 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, expressRoutePortName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, expressRoutePortName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, expressRoutePortName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @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>; + + /** + * Retrieve the ExpressRouteLink sub-resources of the specified + * ExpressRoutePort resource. + * + * @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 {ExpressRouteLinkListResult} - 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. + * + * {ExpressRouteLinkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteLinkListResult} 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 * InterfaceEndpoints diff --git a/lib/services/networkManagement2/lib/operations/index.js b/lib/services/networkManagement2/lib/operations/index.js index 29e0dc7771..d8490505b3 100644 --- a/lib/services/networkManagement2/lib/operations/index.js +++ b/lib/services/networkManagement2/lib/operations/index.js @@ -31,6 +31,9 @@ exports.ExpressRouteCrossConnections = require('./expressRouteCrossConnections') exports.ExpressRouteCrossConnectionPeerings = require('./expressRouteCrossConnectionPeerings'); exports.ExpressRouteGateways = require('./expressRouteGateways'); exports.ExpressRouteConnections = require('./expressRouteConnections'); +exports.ExpressRoutePortsLocations = require('./expressRoutePortsLocations'); +exports.ExpressRoutePorts = require('./expressRoutePorts'); +exports.ExpressRouteLinks = require('./expressRouteLinks'); exports.InterfaceEndpoints = require('./interfaceEndpoints'); exports.LoadBalancers = require('./loadBalancers'); exports.LoadBalancerBackendAddressPools = require('./loadBalancerBackendAddressPools');