diff --git a/lib/services/networkManagement2/lib/models/expressRouteCircuit.js b/lib/services/networkManagement2/lib/models/expressRouteCircuit.js index 1c99d44dbe..0bade28fa8 100644 --- a/lib/services/networkManagement2/lib/models/expressRouteCircuit.js +++ b/lib/services/networkManagement2/lib/models/expressRouteCircuit.js @@ -23,7 +23,8 @@ class ExpressRouteCircuit extends models['Resource'] { * @member {object} [sku] The SKU. * @member {string} [sku.name] The name of the SKU. * @member {string} [sku.tier] The tier of the SKU. Possible values are - * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * @member {string} [sku.family] The family of the SKU. Possible values are: * 'UnlimitedData' and 'MeteredData'. Possible values include: * 'UnlimitedData', 'MeteredData' diff --git a/lib/services/networkManagement2/lib/models/expressRouteCircuitSku.js b/lib/services/networkManagement2/lib/models/expressRouteCircuitSku.js index 3fc69adc76..eedc3b28d8 100644 --- a/lib/services/networkManagement2/lib/models/expressRouteCircuitSku.js +++ b/lib/services/networkManagement2/lib/models/expressRouteCircuitSku.js @@ -19,7 +19,8 @@ class ExpressRouteCircuitSku { * Create a ExpressRouteCircuitSku. * @member {string} [name] The name of the SKU. * @member {string} [tier] The tier of the SKU. Possible values are - * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * @member {string} [family] The family of the SKU. Possible values are: * 'UnlimitedData' and 'MeteredData'. Possible values include: * 'UnlimitedData', 'MeteredData' diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index b0a06b539b..592bcc3ad6 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5395,8 +5395,9 @@ export interface Ipv6ExpressRouteCircuitPeeringConfig { * Contains SKU in an ExpressRouteCircuit. * * @member {string} [name] The name of the SKU. - * @member {string} [tier] The tier of the SKU. Possible values are 'Standard' - * and 'Premium'. Possible values include: 'Standard', 'Premium' + * @member {string} [tier] The tier of the SKU. Possible values are 'Standard', + * 'Premium' or 'Basic'. Possible values include: 'Standard', 'Premium', + * 'Basic' * @member {string} [family] The family of the SKU. Possible values are: * 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', * 'MeteredData' @@ -5432,7 +5433,8 @@ export interface ExpressRouteCircuitServiceProviderProperties { * @member {object} [sku] The SKU. * @member {string} [sku.name] The name of the SKU. * @member {string} [sku.tier] The tier of the SKU. Possible values are - * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * @member {string} [sku.family] The family of the SKU. Possible values are: * 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', * 'MeteredData' @@ -10345,6 +10347,18 @@ export interface LoadBalancerLoadBalancingRuleListResult extends Array { + readonly nextLink?: string; +} + /** * @class * Initializes a new instance of the NetworkInterfaceListResult class. diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index 996ed19f35..d2a62a97e8 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -313,6 +313,7 @@ exports.LoadBalancerBackendAddressPoolListResult = require('./loadBalancerBacken exports.LoadBalancerFrontendIPConfigurationListResult = require('./loadBalancerFrontendIPConfigurationListResult'); exports.InboundNatRuleListResult = require('./inboundNatRuleListResult'); exports.LoadBalancerLoadBalancingRuleListResult = require('./loadBalancerLoadBalancingRuleListResult'); +exports.LoadBalancerOutboundRuleListResult = require('./loadBalancerOutboundRuleListResult'); exports.NetworkInterfaceListResult = require('./networkInterfaceListResult'); exports.LoadBalancerProbeListResult = require('./loadBalancerProbeListResult'); exports.NetworkInterfaceIPConfigurationListResult = require('./networkInterfaceIPConfigurationListResult'); diff --git a/lib/services/networkManagement2/lib/models/loadBalancerOutboundRuleListResult.js b/lib/services/networkManagement2/lib/models/loadBalancerOutboundRuleListResult.js new file mode 100644 index 0000000000..7037ecebf8 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/loadBalancerOutboundRuleListResult.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'; + +/** + * Response for ListOutboundRule API service call. + */ +class LoadBalancerOutboundRuleListResult extends Array { + /** + * Create a LoadBalancerOutboundRuleListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerOutboundRuleListResult + * + * @returns {object} metadata of LoadBalancerOutboundRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerOutboundRuleListResult', + type: { + name: 'Composite', + className: 'LoadBalancerOutboundRuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OutboundRuleElementType', + type: { + name: 'Composite', + className: 'OutboundRule' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerOutboundRuleListResult; diff --git a/lib/services/networkManagement2/lib/networkManagementClient.d.ts b/lib/services/networkManagement2/lib/networkManagementClient.d.ts index db8221d87c..463c4db920 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.d.ts +++ b/lib/services/networkManagement2/lib/networkManagementClient.d.ts @@ -80,6 +80,7 @@ export default class NetworkManagementClient extends AzureServiceClient { loadBalancerFrontendIPConfigurations: operations.LoadBalancerFrontendIPConfigurations; inboundNatRules: operations.InboundNatRules; loadBalancerLoadBalancingRules: operations.LoadBalancerLoadBalancingRules; + loadBalancerOutboundRules: operations.LoadBalancerOutboundRules; loadBalancerNetworkInterfaces: operations.LoadBalancerNetworkInterfaces; loadBalancerProbes: operations.LoadBalancerProbes; networkInterfaces: operations.NetworkInterfaces; diff --git a/lib/services/networkManagement2/lib/networkManagementClient.js b/lib/services/networkManagement2/lib/networkManagementClient.js index 93d6d0dbff..5dd51810ee 100644 --- a/lib/services/networkManagement2/lib/networkManagementClient.js +++ b/lib/services/networkManagement2/lib/networkManagementClient.js @@ -390,6 +390,7 @@ class NetworkManagementClient extends ServiceClient { this.loadBalancerFrontendIPConfigurations = new operations.LoadBalancerFrontendIPConfigurations(this); this.inboundNatRules = new operations.InboundNatRules(this); this.loadBalancerLoadBalancingRules = new operations.LoadBalancerLoadBalancingRules(this); + this.loadBalancerOutboundRules = new operations.LoadBalancerOutboundRules(this); this.loadBalancerNetworkInterfaces = new operations.LoadBalancerNetworkInterfaces(this); this.loadBalancerProbes = new operations.LoadBalancerProbes(this); this.networkInterfaces = new operations.NetworkInterfaces(this); diff --git a/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js b/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js index 9b2382f894..dd4725baf6 100644 --- a/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js +++ b/lib/services/networkManagement2/lib/operations/expressRouteCircuits.js @@ -236,7 +236,8 @@ function _get(resourceGroupName, circuitName, options, callback) { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -1408,7 +1409,8 @@ function _beginDeleteMethod(resourceGroupName, circuitName, options, callback) { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -2748,7 +2750,8 @@ class ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -2850,7 +2853,8 @@ class ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -3787,7 +3791,8 @@ class ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -3889,7 +3894,8 @@ class ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index 50d1f6586d..9dfaedf8c3 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -6288,7 +6288,8 @@ export interface ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -6378,7 +6379,8 @@ export interface ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -7057,7 +7059,8 @@ export interface ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -7147,7 +7150,8 @@ export interface ExpressRouteCircuits { * @param {string} [parameters.sku.name] The name of the SKU. * * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values - * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * are 'Standard', 'Premium' or 'Basic'. Possible values include: 'Standard', + * 'Premium', 'Basic' * * @param {string} [parameters.sku.family] The family of the SKU. Possible * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: @@ -14977,6 +14981,196 @@ export interface LoadBalancerLoadBalancingRules { listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } +/** + * @class + * LoadBalancerOutboundRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerOutboundRules { + + + /** + * Gets all the outbound rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @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, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the outbound rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @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 {LoadBalancerOutboundRuleListResult} - 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. + * + * {LoadBalancerOutboundRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerOutboundRuleListResult} 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, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified load balancer outbound rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} outboundRuleName The name of the outbound rule. + * + * @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, loadBalancerName: string, outboundRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified load balancer outbound rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} outboundRuleName The name of the outbound rule. + * + * @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 {OutboundRule} - 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. + * + * {OutboundRule} [result] - The deserialized result object if an error did not occur. + * See {@link OutboundRule} 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, loadBalancerName: string, outboundRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, outboundRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, outboundRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the outbound rules in a load balancer. + * + * @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>; + + /** + * Gets all the outbound rules in a load balancer. + * + * @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 {LoadBalancerOutboundRuleListResult} - 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. + * + * {LoadBalancerOutboundRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerOutboundRuleListResult} 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 * LoadBalancerNetworkInterfaces @@ -32922,14 +33116,14 @@ export interface VirtualNetworks { /** * Checks whether a private IP address is available for use. * + * @param {string} ipAddress The private IP address to be verified. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} virtualNetworkName The name of the virtual network. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ipAddress] The private IP address to be verified. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -32939,19 +33133,19 @@ export interface VirtualNetworks { * * @reject {Error|ServiceError} - The error object. */ - checkIPAddressAvailabilityWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + checkIPAddressAvailabilityWithHttpOperationResponse(ipAddress: string, resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; /** * Checks whether a private IP address is available for use. * + * @param {string} ipAddress The private IP address to be verified. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} virtualNetworkName The name of the virtual network. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ipAddress] The private IP address to be verified. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -32978,9 +33172,9 @@ export interface VirtualNetworks { * * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. */ - checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, options?: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }): Promise; - checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; - checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, options: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + checkIPAddressAvailability(ipAddress: string, resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkIPAddressAvailability(ipAddress: string, resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + checkIPAddressAvailability(ipAddress: string, resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; /** diff --git a/lib/services/networkManagement2/lib/operations/index.js b/lib/services/networkManagement2/lib/operations/index.js index d8490505b3..6866063f4f 100644 --- a/lib/services/networkManagement2/lib/operations/index.js +++ b/lib/services/networkManagement2/lib/operations/index.js @@ -40,6 +40,7 @@ exports.LoadBalancerBackendAddressPools = require('./loadBalancerBackendAddressP exports.LoadBalancerFrontendIPConfigurations = require('./loadBalancerFrontendIPConfigurations'); exports.InboundNatRules = require('./inboundNatRules'); exports.LoadBalancerLoadBalancingRules = require('./loadBalancerLoadBalancingRules'); +exports.LoadBalancerOutboundRules = require('./loadBalancerOutboundRules'); exports.LoadBalancerNetworkInterfaces = require('./loadBalancerNetworkInterfaces'); exports.LoadBalancerProbes = require('./loadBalancerProbes'); exports.NetworkInterfaces = require('./networkInterfaces'); diff --git a/lib/services/networkManagement2/lib/operations/loadBalancerOutboundRules.js b/lib/services/networkManagement2/lib/operations/loadBalancerOutboundRules.js new file mode 100644 index 0000000000..c3651470b2 --- /dev/null +++ b/lib/services/networkManagement2/lib/operations/loadBalancerOutboundRules.js @@ -0,0 +1,715 @@ +/* + * 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; + +/** + * Gets all the outbound rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @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 LoadBalancerOutboundRuleListResult} 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, loadBalancerName, 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 (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 (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + 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['LoadBalancerOutboundRuleListResult']().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); + }); +} + +/** + * Gets the specified load balancer outbound rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} outboundRuleName The name of the outbound rule. + * + * @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 OutboundRule} 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, loadBalancerName, outboundRuleName, 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 (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 (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (outboundRuleName === null || outboundRuleName === undefined || typeof outboundRuleName.valueOf() !== 'string') { + throw new Error('outboundRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/outboundRules/{outboundRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{outboundRuleName}', encodeURIComponent(outboundRuleName)); + 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['OutboundRule']().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); + }); +} + +/** + * Gets all the outbound rules in a load balancer. + * + * @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 LoadBalancerOutboundRuleListResult} 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['LoadBalancerOutboundRuleListResult']().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 LoadBalancerOutboundRules. */ +class LoadBalancerOutboundRules { + /** + * Create a LoadBalancerOutboundRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all the outbound rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @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, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the outbound rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @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 {LoadBalancerOutboundRuleListResult} - 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 LoadBalancerOutboundRuleListResult} 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, loadBalancerName, 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, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets the specified load balancer outbound rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} outboundRuleName The name of the outbound rule. + * + * @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, loadBalancerName, outboundRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, outboundRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified load balancer outbound rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} outboundRuleName The name of the outbound rule. + * + * @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 {OutboundRule} - 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 OutboundRule} 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, loadBalancerName, outboundRuleName, 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, loadBalancerName, outboundRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, outboundRuleName, options, optionalCallback); + } + } + + /** + * Gets all the outbound rules in a load balancer. + * + * @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; + }); + }); + } + + /** + * Gets all the outbound rules in a load balancer. + * + * @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 {LoadBalancerOutboundRuleListResult} - 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 LoadBalancerOutboundRuleListResult} 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 = LoadBalancerOutboundRules; diff --git a/lib/services/networkManagement2/lib/operations/virtualNetworks.js b/lib/services/networkManagement2/lib/operations/virtualNetworks.js index 6e77492dc7..8135d19951 100644 --- a/lib/services/networkManagement2/lib/operations/virtualNetworks.js +++ b/lib/services/networkManagement2/lib/operations/virtualNetworks.js @@ -711,14 +711,14 @@ function _list(resourceGroupName, options, callback) { /** * Checks whether a private IP address is available for use. * + * @param {string} ipAddress The private IP address to be verified. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} virtualNetworkName The name of the virtual network. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ipAddress] The private IP address to be verified. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -736,7 +736,7 @@ function _list(resourceGroupName, options, callback) { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ -function _checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, callback) { +function _checkIPAddressAvailability(ipAddress, resourceGroupName, virtualNetworkName, options, callback) { /* jshint validthis: true */ let client = this.client; if(!callback && typeof options === 'function') { @@ -746,12 +746,11 @@ function _checkIPAddressAvailability(resourceGroupName, virtualNetworkName, opti if (!callback) { throw new Error('callback cannot be null.'); } - let ipAddress = (options && options.ipAddress !== undefined) ? options.ipAddress : undefined; let apiVersion = '2018-08-01'; // Validate try { - if (ipAddress !== null && ipAddress !== undefined && typeof ipAddress.valueOf() !== 'string') { - throw new Error('ipAddress must be of type string.'); + if (ipAddress === null || ipAddress === undefined || typeof ipAddress.valueOf() !== 'string') { + throw new Error('ipAddress 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.'); @@ -776,9 +775,7 @@ function _checkIPAddressAvailability(resourceGroupName, virtualNetworkName, opti requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); let queryParameters = []; - if (ipAddress !== null && ipAddress !== undefined) { - queryParameters.push('ipAddress=' + encodeURIComponent(ipAddress)); - } + queryParameters.push('ipAddress=' + encodeURIComponent(ipAddress)); queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); if (queryParameters.length > 0) { requestUrl += '?' + queryParameters.join('&'); @@ -2546,14 +2543,14 @@ class VirtualNetworks { /** * Checks whether a private IP address is available for use. * + * @param {string} ipAddress The private IP address to be verified. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} virtualNetworkName The name of the virtual network. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ipAddress] The private IP address to be verified. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2563,11 +2560,11 @@ class VirtualNetworks { * * @reject {Error} - The error object. */ - checkIPAddressAvailabilityWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + checkIPAddressAvailabilityWithHttpOperationResponse(ipAddress, resourceGroupName, virtualNetworkName, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + self._checkIPAddressAvailability(ipAddress, resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -2580,14 +2577,14 @@ class VirtualNetworks { /** * Checks whether a private IP address is available for use. * + * @param {string} ipAddress The private IP address to be verified. + * * @param {string} resourceGroupName The name of the resource group. * * @param {string} virtualNetworkName The name of the virtual network. * * @param {object} [options] Optional Parameters. * - * @param {string} [options.ipAddress] The private IP address to be verified. - * * @param {object} [options.customHeaders] Headers that will be added to the * request * @@ -2614,7 +2611,7 @@ class VirtualNetworks { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, optionalCallback) { + checkIPAddressAvailability(ipAddress, resourceGroupName, virtualNetworkName, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -2623,14 +2620,14 @@ class VirtualNetworks { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + self._checkIPAddressAvailability(ipAddress, resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, optionalCallback); + return self._checkIPAddressAvailability(ipAddress, resourceGroupName, virtualNetworkName, options, optionalCallback); } }