From dcf6e72471454f38771fb3245ea174246760297c Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 16 Aug 2018 22:26:49 +0000 Subject: [PATCH] Generated from e84817da8f32e67957ec454db99b17fa7813621d removed QueryConnectionMonitors Api --- .../lib/models/backendAddressPool.js | 10 +- .../lib/models/frontendIPConfiguration.js | 17 +- .../networkManagement2/lib/models/index.d.ts | 77 +- .../networkManagement2/lib/models/index.js | 5 +- .../lib/models/loadBalancer.js | 10 +- .../lib/models/outboundRule.js | 148 +++ .../lib/operations/index.d.ts | 268 +--- .../lib/operations/loadBalancers.js | 12 +- .../lib/operations/networkWatchers.js | 1076 ++--------------- 9 files changed, 313 insertions(+), 1310 deletions(-) create mode 100644 lib/services/networkManagement2/lib/models/outboundRule.js diff --git a/lib/services/networkManagement2/lib/models/backendAddressPool.js b/lib/services/networkManagement2/lib/models/backendAddressPool.js index 5311a4e163..5a8cd61113 100644 --- a/lib/services/networkManagement2/lib/models/backendAddressPool.js +++ b/lib/services/networkManagement2/lib/models/backendAddressPool.js @@ -24,9 +24,9 @@ class BackendAddressPool extends models['SubResource'] { * IP addresses defined in network interfaces. * @member {array} [loadBalancingRules] Gets load balancing rules that use * this backend address pool. - * @member {object} [outboundNatRule] Gets outbound rules that use this - * backend address pool. - * @member {string} [outboundNatRule.id] Resource ID. + * @member {object} [outboundRule] Gets outbound rules that use this backend + * address pool. + * @member {string} [outboundRule.id] Resource ID. * @member {string} [provisioningState] Get provisioning state of the public * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * @member {string} [name] Gets name of the resource that is unique within a @@ -91,10 +91,10 @@ class BackendAddressPool extends models['SubResource'] { } } }, - outboundNatRule: { + outboundRule: { required: false, readOnly: true, - serializedName: 'properties.outboundNatRule', + serializedName: 'properties.outboundRule', type: { name: 'Composite', className: 'SubResource' diff --git a/lib/services/networkManagement2/lib/models/frontendIPConfiguration.js b/lib/services/networkManagement2/lib/models/frontendIPConfiguration.js index fc40be349e..9cb1956954 100644 --- a/lib/services/networkManagement2/lib/models/frontendIPConfiguration.js +++ b/lib/services/networkManagement2/lib/models/frontendIPConfiguration.js @@ -24,7 +24,7 @@ class FrontendIPConfiguration extends models['SubResource'] { * this frontend IP. * @member {array} [inboundNatPools] Read only. Inbound pools URIs that use * this frontend IP. - * @member {array} [outboundNatRules] Read only. Outbound rules URIs that use + * @member {array} [outboundRules] Read only. Outbound rules URIs that use * this frontend IP. * @member {array} [loadBalancingRules] Gets load balancing rules URIs that * use this frontend IP. @@ -209,6 +209,9 @@ class FrontendIPConfiguration extends models['SubResource'] { * changes whenever the resource is updated. * @member {array} [publicIPAddress.zones] A list of availability zones * denoting the IP allocated for the resource needs to come from. + * @member {object} [publicIPPrefix] The reference of the Public IP Prefix + * resource. + * @member {string} [publicIPPrefix.id] Resource ID. * @member {string} [provisioningState] Gets the provisioning state of the * public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -276,10 +279,10 @@ class FrontendIPConfiguration extends models['SubResource'] { } } }, - outboundNatRules: { + outboundRules: { required: false, readOnly: true, - serializedName: 'properties.outboundNatRules', + serializedName: 'properties.outboundRules', type: { name: 'Sequence', element: { @@ -338,6 +341,14 @@ class FrontendIPConfiguration extends models['SubResource'] { className: 'PublicIPAddress' } }, + publicIPPrefix: { + required: false, + serializedName: 'properties.publicIPPrefix', + type: { + name: 'Composite', + className: 'SubResource' + } + }, provisioningState: { required: false, serializedName: 'properties.provisioningState', diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index f59b52546b..51f3cc1d25 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -246,9 +246,9 @@ export interface AzureFirewall extends Resource { * IP addresses defined in network interfaces. * @member {array} [loadBalancingRules] Gets load balancing rules that use this * backend address pool. - * @member {object} [outboundNatRule] Gets outbound rules that use this backend + * @member {object} [outboundRule] Gets outbound rules that use this backend * address pool. - * @member {string} [outboundNatRule.id] Resource ID. + * @member {string} [outboundRule.id] Resource ID. * @member {string} [provisioningState] Get provisioning state of the public IP * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. * @member {string} [name] Gets name of the resource that is unique within a @@ -259,7 +259,7 @@ export interface AzureFirewall extends Resource { export interface BackendAddressPool extends SubResource { readonly backendIPConfigurations?: NetworkInterfaceIPConfiguration[]; readonly loadBalancingRules?: SubResource[]; - readonly outboundNatRule?: SubResource; + readonly outboundRule?: SubResource; provisioningState?: string; name?: string; etag?: string; @@ -3577,8 +3577,8 @@ export interface LoadBalancerSku { * this frontend IP. * @member {array} [inboundNatPools] Read only. Inbound pools URIs that use * this frontend IP. - * @member {array} [outboundNatRules] Read only. Outbound rules URIs that use - * this frontend IP. + * @member {array} [outboundRules] Read only. Outbound rules URIs that use this + * frontend IP. * @member {array} [loadBalancingRules] Gets load balancing rules URIs that use * this frontend IP. * @member {string} [privateIPAddress] The private IP address of the IP @@ -3757,6 +3757,9 @@ export interface LoadBalancerSku { * changes whenever the resource is updated. * @member {array} [publicIPAddress.zones] A list of availability zones * denoting the IP allocated for the resource needs to come from. + * @member {object} [publicIPPrefix] The reference of the Public IP Prefix + * resource. + * @member {string} [publicIPPrefix.id] Resource ID. * @member {string} [provisioningState] Gets the provisioning state of the * public IP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. @@ -3770,12 +3773,13 @@ export interface LoadBalancerSku { export interface FrontendIPConfiguration extends SubResource { readonly inboundNatRules?: SubResource[]; readonly inboundNatPools?: SubResource[]; - readonly outboundNatRules?: SubResource[]; + readonly outboundRules?: SubResource[]; readonly loadBalancingRules?: SubResource[]; privateIPAddress?: string; privateIPAllocationMethod?: string; subnet?: Subnet; publicIPAddress?: PublicIPAddress; + publicIPPrefix?: SubResource; provisioningState?: string; name?: string; etag?: string; @@ -3947,9 +3951,9 @@ export interface InboundNatPool extends SubResource { /** * @class - * Initializes a new instance of the OutboundNatRule class. + * Initializes a new instance of the OutboundRule class. * @constructor - * Outbound NAT pool of the load balancer. + * Outbound pool of the load balancer. * * @member {number} [allocatedOutboundPorts] The number of outbound ports to be * used for NAT. @@ -3961,16 +3965,26 @@ export interface InboundNatPool extends SubResource { * @member {string} [provisioningState] Gets the provisioning state of the * PublicIP resource. Possible values are: 'Updating', 'Deleting', and * 'Failed'. + * @member {string} [protocol] Protocol - TCP, UDP or All. Possible values + * include: 'Tcp', 'Udp', 'All' + * @member {boolean} [enableTcpReset] Receive bidirectional TCP Reset on TCP + * flow idle timeout or unexpected connection termination. This element is only + * used when the protocol is set to TCP. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection * @member {string} [name] The name of the resource that is unique within a * resource group. This name can be used to access the resource. * @member {string} [etag] A unique read-only string that changes whenever the * resource is updated. */ -export interface OutboundNatRule extends SubResource { +export interface OutboundRule extends SubResource { allocatedOutboundPorts?: number; frontendIPConfigurations?: SubResource[]; backendAddressPool: SubResource; provisioningState?: string; + protocol?: string; + enableTcpReset?: boolean; + idleTimeoutInMinutes?: number; name?: string; etag?: string; } @@ -4006,7 +4020,7 @@ export interface OutboundNatRule extends SubResource { * Nat rules. Inbound NAT pools are referenced from virtual machine scale sets. * NICs that are associated with individual virtual machines cannot reference * an inbound NAT pool. They have to reference individual inbound NAT rules. - * @member {array} [outboundNatRules] The outbound NAT rules. + * @member {array} [outboundRules] The outbound rules. * @member {string} [resourceGuid] The resource GUID property of the load * balancer resource. * @member {string} [provisioningState] Gets the provisioning state of the @@ -4023,7 +4037,7 @@ export interface LoadBalancer extends Resource { probes?: Probe[]; inboundNatRules?: InboundNatRule[]; inboundNatPools?: InboundNatPool[]; - outboundNatRules?: OutboundNatRule[]; + outboundRules?: OutboundRule[]; resourceGuid?: string; provisioningState?: string; etag?: string; @@ -5678,35 +5692,6 @@ export interface NetworkConfigurationDiagnosticResponse { readonly results?: NetworkConfigurationDiagnosticResult[]; } -/** - * @class - * Initializes a new instance of the QueryConnectionMonitorsParameters class. - * @constructor - * Parameters to query connection monitors. - * - * @member {array} [connectionMonitorIds] List of connection monitors ID. - */ -export interface QueryConnectionMonitorsParameters { - connectionMonitorIds?: string[]; -} - -/** - * @class - * Initializes a new instance of the ConnectionMonitorsQueryResultItem class. - * @constructor - * Results of query particular connection monitor. - * - * @member {string} [resourceId] Connection monitor resource ID. - * @member {object} [report] - * @member {string} [report.sourceStatus] Status of connection monitor source. - * Possible values include: 'Uknown', 'Active', 'Inactive' - * @member {array} [report.states] Information about connection states. - */ -export interface ConnectionMonitorsQueryResultItem { - resourceId?: string; - report?: ConnectionMonitorQueryResult; -} - /** * @class * Initializes a new instance of the OperationDisplay class. @@ -7601,18 +7586,6 @@ export interface SecurityRuleListResult extends Array { export interface NetworkWatcherListResult extends Array { } -/** - * @class - * Initializes a new instance of the QueryConnectionMonitorsResponse class. - * @constructor - * Results of query connection monitors. - * - * @member {string} [nextLink] URL to get the next set of results. - */ -export interface QueryConnectionMonitorsResponse extends Array { - nextLink?: string; -} - /** * @class * Initializes a new instance of the PacketCaptureListResult class. diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index a00f511765..7be11fcda4 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -114,7 +114,7 @@ exports.FrontendIPConfiguration = require('./frontendIPConfiguration'); exports.LoadBalancingRule = require('./loadBalancingRule'); exports.Probe = require('./probe'); exports.InboundNatPool = require('./inboundNatPool'); -exports.OutboundNatRule = require('./outboundNatRule'); +exports.OutboundRule = require('./outboundRule'); exports.LoadBalancer = require('./loadBalancer'); exports.ErrorDetails = require('./errorDetails'); exports.ErrorModel = require('./errorModel'); @@ -191,8 +191,6 @@ exports.EvaluatedNetworkSecurityGroup = require('./evaluatedNetworkSecurityGroup exports.NetworkSecurityGroupResult = require('./networkSecurityGroupResult'); exports.NetworkConfigurationDiagnosticResult = require('./networkConfigurationDiagnosticResult'); exports.NetworkConfigurationDiagnosticResponse = require('./networkConfigurationDiagnosticResponse'); -exports.QueryConnectionMonitorsParameters = require('./queryConnectionMonitorsParameters'); -exports.ConnectionMonitorsQueryResultItem = require('./connectionMonitorsQueryResultItem'); exports.OperationDisplay = require('./operationDisplay'); exports.Availability = require('./availability'); exports.Dimension = require('./dimension'); @@ -272,7 +270,6 @@ exports.NetworkInterfaceLoadBalancerListResult = require('./networkInterfaceLoad exports.NetworkSecurityGroupListResult = require('./networkSecurityGroupListResult'); exports.SecurityRuleListResult = require('./securityRuleListResult'); exports.NetworkWatcherListResult = require('./networkWatcherListResult'); -exports.QueryConnectionMonitorsResponse = require('./queryConnectionMonitorsResponse'); exports.PacketCaptureListResult = require('./packetCaptureListResult'); exports.ConnectionMonitorListResult = require('./connectionMonitorListResult'); exports.OperationListResult = require('./operationListResult'); diff --git a/lib/services/networkManagement2/lib/models/loadBalancer.js b/lib/services/networkManagement2/lib/models/loadBalancer.js index a0e73dfe7b..506f205995 100644 --- a/lib/services/networkManagement2/lib/models/loadBalancer.js +++ b/lib/services/networkManagement2/lib/models/loadBalancer.js @@ -46,7 +46,7 @@ class LoadBalancer extends models['Resource'] { * virtual machine scale sets. NICs that are associated with individual * virtual machines cannot reference an inbound NAT pool. They have to * reference individual inbound NAT rules. - * @member {array} [outboundNatRules] The outbound NAT rules. + * @member {array} [outboundRules] The outbound rules. * @member {string} [resourceGuid] The resource GUID property of the load * balancer resource. * @member {string} [provisioningState] Gets the provisioning state of the @@ -215,17 +215,17 @@ class LoadBalancer extends models['Resource'] { } } }, - outboundNatRules: { + outboundRules: { required: false, - serializedName: 'properties.outboundNatRules', + serializedName: 'properties.outboundRules', type: { name: 'Sequence', element: { required: false, - serializedName: 'OutboundNatRuleElementType', + serializedName: 'OutboundRuleElementType', type: { name: 'Composite', - className: 'OutboundNatRule' + className: 'OutboundRule' } } } diff --git a/lib/services/networkManagement2/lib/models/outboundRule.js b/lib/services/networkManagement2/lib/models/outboundRule.js new file mode 100644 index 0000000000..a57b753c3b --- /dev/null +++ b/lib/services/networkManagement2/lib/models/outboundRule.js @@ -0,0 +1,148 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Outbound pool of the load balancer. + * + * @extends models['SubResource'] + */ +class OutboundRule extends models['SubResource'] { + /** + * Create a OutboundRule. + * @member {number} [allocatedOutboundPorts] The number of outbound ports to + * be used for NAT. + * @member {array} [frontendIPConfigurations] The Frontend IP addresses of + * the load balancer. + * @member {object} backendAddressPool A reference to a pool of DIPs. + * Outbound traffic is randomly load balanced across IPs in the backend IPs. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [protocol] Protocol - TCP, UDP or All. Possible values + * include: 'Tcp', 'Udp', 'All' + * @member {boolean} [enableTcpReset] Receive bidirectional TCP Reset on TCP + * flow idle timeout or unexpected connection termination. This element is + * only used when the protocol is set to TCP. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OutboundRule + * + * @returns {object} metadata of OutboundRule + * + */ + mapper() { + return { + required: false, + serializedName: 'OutboundRule', + type: { + name: 'Composite', + className: 'OutboundRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + allocatedOutboundPorts: { + required: false, + serializedName: 'properties.allocatedOutboundPorts', + type: { + name: 'Number' + } + }, + frontendIPConfigurations: { + required: false, + serializedName: 'properties.frontendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + backendAddressPool: { + required: true, + serializedName: 'properties.backendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + enableTcpReset: { + required: false, + serializedName: 'properties.enableTcpReset', + type: { + name: 'Boolean' + } + }, + idleTimeoutInMinutes: { + required: false, + serializedName: 'properties.idleTimeoutInMinutes', + type: { + name: 'Number' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OutboundRule; diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index dd8aad8230..fd229a57ae 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -9415,7 +9415,7 @@ export interface LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -9490,7 +9490,7 @@ export interface LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -9817,7 +9817,7 @@ export interface LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -9892,7 +9892,7 @@ export interface LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -17046,78 +17046,6 @@ export interface NetworkWatchers { getNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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. - */ - queryConnectionMonitorsWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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 {QueryConnectionMonitorsResponse} - 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. - * - * {QueryConnectionMonitorsResponse} [result] - The deserialized result object if an error did not occur. - * See {@link QueryConnectionMonitorsResponse} 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. - */ - queryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - queryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, callback: ServiceCallback): void; - queryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - /** * Deletes the specified network watcher resource. * @@ -18245,194 +18173,6 @@ export interface NetworkWatchers { beginGetNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginGetNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, callback: ServiceCallback): void; beginGetNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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. - */ - beginQueryConnectionMonitorsWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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 {QueryConnectionMonitorsResponse} - 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. - * - * {QueryConnectionMonitorsResponse} [result] - The deserialized result object if an error did not occur. - * See {@link QueryConnectionMonitorsResponse} 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. - */ - beginQueryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginQueryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, callback: ServiceCallback): void; - beginQueryConnectionMonitors(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryConnectionMonitorsParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Query connection monitors. - * - * @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. - */ - queryConnectionMonitorsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Query connection monitors. - * - * @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 {QueryConnectionMonitorsResponse} - 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. - * - * {QueryConnectionMonitorsResponse} [result] - The deserialized result object if an error did not occur. - * See {@link QueryConnectionMonitorsResponse} 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. - */ - queryConnectionMonitorsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - queryConnectionMonitorsNext(nextPageLink: string, callback: ServiceCallback): void; - queryConnectionMonitorsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; - - - /** - * Query connection monitors. - * - * @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. - */ - beginQueryConnectionMonitorsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; - - /** - * Query connection monitors. - * - * @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 {QueryConnectionMonitorsResponse} - 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. - * - * {QueryConnectionMonitorsResponse} [result] - The deserialized result object if an error did not occur. - * See {@link QueryConnectionMonitorsResponse} 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. - */ - beginQueryConnectionMonitorsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; - beginQueryConnectionMonitorsNext(nextPageLink: string, callback: ServiceCallback): void; - beginQueryConnectionMonitorsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; } /** diff --git a/lib/services/networkManagement2/lib/operations/loadBalancers.js b/lib/services/networkManagement2/lib/operations/loadBalancers.js index 7a460a9053..96357d1edc 100644 --- a/lib/services/networkManagement2/lib/operations/loadBalancers.js +++ b/lib/services/networkManagement2/lib/operations/loadBalancers.js @@ -274,7 +274,7 @@ function _get(resourceGroupName, loadBalancerName, options, callback) { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -883,7 +883,7 @@ function _beginDeleteMethod(resourceGroupName, loadBalancerName, options, callba * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -1731,7 +1731,7 @@ class LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -1818,7 +1818,7 @@ class LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -2268,7 +2268,7 @@ class LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. @@ -2355,7 +2355,7 @@ class LoadBalancers { * machines cannot reference an inbound NAT pool. They have to reference * individual inbound NAT rules. * - * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * @param {array} [parameters.outboundRules] The outbound rules. * * @param {string} [parameters.resourceGuid] The resource GUID property of the * load balancer resource. diff --git a/lib/services/networkManagement2/lib/operations/networkWatchers.js b/lib/services/networkManagement2/lib/operations/networkWatchers.js index a672f1d77a..186911dcdb 100644 --- a/lib/services/networkManagement2/lib/operations/networkWatchers.js +++ b/lib/services/networkManagement2/lib/operations/networkWatchers.js @@ -2096,91 +2096,6 @@ function _getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherNam }); } - -/** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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 QueryConnectionMonitorsResponse} 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 _queryConnectionMonitors(resourceGroupName, networkWatcherName, 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.beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, 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['QueryConnectionMonitorsResponse']().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 network watcher resource. * @@ -4479,501 +4394,88 @@ function _beginGetNetworkConfigurationDiagnostic(resourceGroupName, networkWatch }); } -/** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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 QueryConnectionMonitorsResponse} 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 _beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, 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-07-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 (networkWatcherName === null || networkWatcherName === undefined || typeof networkWatcherName.valueOf() !== 'string') { - throw new Error('networkWatcherName 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.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); +/** Class representing a NetworkWatchers. */ +class NetworkWatchers { + /** + * Create a NetworkWatchers. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._updateTags = _updateTags; + this._list = _list; + this._listAll = _listAll; + this._getTopology = _getTopology; + this._verifyIPFlow = _verifyIPFlow; + this._getNextHop = _getNextHop; + this._getVMSecurityRules = _getVMSecurityRules; + this._getTroubleshooting = _getTroubleshooting; + this._getTroubleshootingResult = _getTroubleshootingResult; + this._setFlowLogConfiguration = _setFlowLogConfiguration; + this._getFlowLogStatus = _getFlowLogStatus; + this._checkConnectivity = _checkConnectivity; + this._getAzureReachabilityReport = _getAzureReachabilityReport; + this._listAvailableProviders = _listAvailableProviders; + this._getNetworkConfigurationDiagnostic = _getNetworkConfigurationDiagnostic; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginVerifyIPFlow = _beginVerifyIPFlow; + this._beginGetNextHop = _beginGetNextHop; + this._beginGetVMSecurityRules = _beginGetVMSecurityRules; + this._beginGetTroubleshooting = _beginGetTroubleshooting; + this._beginGetTroubleshootingResult = _beginGetTroubleshootingResult; + this._beginSetFlowLogConfiguration = _beginSetFlowLogConfiguration; + this._beginGetFlowLogStatus = _beginGetFlowLogStatus; + this._beginCheckConnectivity = _beginCheckConnectivity; + this._beginGetAzureReachabilityReport = _beginGetAzureReachabilityReport; + this._beginListAvailableProviders = _beginListAvailableProviders; + this._beginGetNetworkConfigurationDiagnostic = _beginGetNetworkConfigurationDiagnostic; } - // Construct URL - let baseUrl = this.client.baseUri; - let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryConnectionMonitors'; - requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); - requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); - 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 = 'POST'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - // Serialize Request - let requestContent = null; - let requestModel = null; - try { - if (parameters !== null && parameters !== undefined) { - let requestModelMapper = new client.models['QueryConnectionMonitorsParameters']().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 !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorResponse']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // 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['QueryConnectionMonitorsResponse']().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 === 202) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['QueryConnectionMonitorsResponse']().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); - }); -} - - -/** - * Query connection monitors. - * - * @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 QueryConnectionMonitorsResponse} 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 _queryConnectionMonitorsNext(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.'); - } - - // Send request - this.beginQueryConnectionMonitorsNext(nextPageLink, 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['QueryConnectionMonitorsResponse']().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); - }); - }); -} - -/** - * Query connection monitors. - * - * @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 QueryConnectionMonitorsResponse} 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 _beginQueryConnectionMonitorsNext(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 = 'POST'; - httpRequest.url = requestUrl; - httpRequest.headers = {}; - // Set Headers - httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; - if (this.client.generateClientRequestId) { - httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); - } - if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { - httpRequest.headers['accept-language'] = this.client.acceptLanguage; - } - if(options) { - for(let headerName in options['customHeaders']) { - if (options['customHeaders'].hasOwnProperty(headerName)) { - httpRequest.headers[headerName] = options['customHeaders'][headerName]; - } - } - } - httpRequest.body = null; - // Send Request - return client.pipeline(httpRequest, (err, response, responseBody) => { - if (err) { - return callback(err); - } - let statusCode = response.statusCode; - if (statusCode !== 200 && statusCode !== 202) { - let error = new Error(responseBody); - error.statusCode = response.statusCode; - error.request = msRest.stripRequest(httpRequest); - error.response = msRest.stripResponse(response); - if (responseBody === '') responseBody = null; - let parsedErrorResponse; - try { - parsedErrorResponse = JSON.parse(responseBody); - if (parsedErrorResponse) { - let internalError = null; - if (parsedErrorResponse.error) internalError = parsedErrorResponse.error; - error.code = internalError ? internalError.code : parsedErrorResponse.code; - error.message = internalError ? internalError.message : parsedErrorResponse.message; - } - if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { - let resultMapper = new client.models['ErrorResponse']().mapper(); - error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); - } - } catch (defaultError) { - error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + - `- "${responseBody}" for the default response.`; - return callback(error); - } - return callback(error); - } - // Create Result - let result = null; - if (responseBody === '') responseBody = null; - // 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['QueryConnectionMonitorsResponse']().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 === 202) { - let parsedResponse = null; - try { - parsedResponse = JSON.parse(responseBody); - result = JSON.parse(responseBody); - if (parsedResponse !== null && parsedResponse !== undefined) { - let resultMapper = new client.models['QueryConnectionMonitorsResponse']().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); - }); -} - -/** Class representing a NetworkWatchers. */ -class NetworkWatchers { - /** - * Create a NetworkWatchers. - * @param {NetworkManagementClient} client Reference to the service client. - */ - constructor(client) { - this.client = client; - this._createOrUpdate = _createOrUpdate; - this._get = _get; - this._deleteMethod = _deleteMethod; - this._updateTags = _updateTags; - this._list = _list; - this._listAll = _listAll; - this._getTopology = _getTopology; - this._verifyIPFlow = _verifyIPFlow; - this._getNextHop = _getNextHop; - this._getVMSecurityRules = _getVMSecurityRules; - this._getTroubleshooting = _getTroubleshooting; - this._getTroubleshootingResult = _getTroubleshootingResult; - this._setFlowLogConfiguration = _setFlowLogConfiguration; - this._getFlowLogStatus = _getFlowLogStatus; - this._checkConnectivity = _checkConnectivity; - this._getAzureReachabilityReport = _getAzureReachabilityReport; - this._listAvailableProviders = _listAvailableProviders; - this._getNetworkConfigurationDiagnostic = _getNetworkConfigurationDiagnostic; - this._queryConnectionMonitors = _queryConnectionMonitors; - this._beginDeleteMethod = _beginDeleteMethod; - this._beginVerifyIPFlow = _beginVerifyIPFlow; - this._beginGetNextHop = _beginGetNextHop; - this._beginGetVMSecurityRules = _beginGetVMSecurityRules; - this._beginGetTroubleshooting = _beginGetTroubleshooting; - this._beginGetTroubleshootingResult = _beginGetTroubleshootingResult; - this._beginSetFlowLogConfiguration = _beginSetFlowLogConfiguration; - this._beginGetFlowLogStatus = _beginGetFlowLogStatus; - this._beginCheckConnectivity = _beginCheckConnectivity; - this._beginGetAzureReachabilityReport = _beginGetAzureReachabilityReport; - this._beginListAvailableProviders = _beginListAvailableProviders; - this._beginGetNetworkConfigurationDiagnostic = _beginGetNetworkConfigurationDiagnostic; - this._beginQueryConnectionMonitors = _beginQueryConnectionMonitors; - this._queryConnectionMonitorsNext = _queryConnectionMonitorsNext; - this._beginQueryConnectionMonitorsNext = _beginQueryConnectionMonitorsNext; - } - - /** - * Creates or updates a network watcher in the specified resource group. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters that define the network watcher - * resource. - * - * @param {string} [parameters.etag] A unique read-only string that changes - * whenever the resource is updated. - * - * @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, networkWatcherName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._createOrUpdate(resourceGroupName, networkWatcherName, 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 a network watcher in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters that define the network watcher + * resource. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @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, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); } /** @@ -6822,118 +6324,13 @@ class NetworkWatchers { * * {object} [result] - The deserialized result object if an error did not occur. * See {@link AvailableProvidersList} 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. - */ - listAvailableProviders(resourceGroupName, networkWatcherName, 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._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); - } - } - - /** - * Get network configuration diagnostic. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {string} parameters.targetResourceId The ID of the target resource to - * perform network configuration diagnostic. Valid options are VM, - * NetworkInterface, VMSS/NetworkInterface and Application Gateway. - * - * @param {array} parameters.queries List of traffic queries. - * - * @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. - */ - getNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Get network configuration diagnostic. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {string} parameters.targetResourceId The ID of the target resource to - * perform network configuration diagnostic. Valid options are VM, - * NetworkInterface, VMSS/NetworkInterface and Application Gateway. - * - * @param {array} parameters.queries List of traffic queries. - * - * @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 {NetworkConfigurationDiagnosticResponse} - 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 NetworkConfigurationDiagnosticResponse} for - * more information. + * 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. */ - getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { + listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6942,19 +6339,19 @@ class NetworkWatchers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + self._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + return self._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); } } /** - * Query connection monitors. + * Get network configuration diagnostic. * * @param {string} resourceGroupName The name of the resource group. * @@ -6963,8 +6360,11 @@ class NetworkWatchers { * @param {object} parameters Parameters to get network configuration * diagnostic. * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform network configuration diagnostic. Valid options are VM, + * NetworkInterface, VMSS/NetworkInterface and Application Gateway. + * + * @param {array} parameters.queries List of traffic queries. * * @param {object} [options] Optional Parameters. * @@ -6973,15 +6373,15 @@ class NetworkWatchers { * * @returns {Promise} A promise is returned * - * @resolve {HttpOperationResponse} - The deserialized result object. + * @resolve {HttpOperationResponse} - The deserialized result object. * * @reject {Error} - The error object. */ - queryConnectionMonitorsWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + getNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { let client = this.client; let self = this; return new Promise((resolve, reject) => { - self._queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6992,7 +6392,7 @@ class NetworkWatchers { } /** - * Query connection monitors. + * Get network configuration diagnostic. * * @param {string} resourceGroupName The name of the resource group. * @@ -7001,8 +6401,11 @@ class NetworkWatchers { * @param {object} parameters Parameters to get network configuration * diagnostic. * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform network configuration diagnostic. Valid options are VM, + * NetworkInterface, VMSS/NetworkInterface and Application Gateway. + * + * @param {array} parameters.queries List of traffic queries. * * @param {object} [options] Optional Parameters. * @@ -7016,7 +6419,7 @@ class NetworkWatchers { * * {Promise} A promise is returned * - * @resolve {QueryConnectionMonitorsResponse} - The deserialized result object. + * @resolve {NetworkConfigurationDiagnosticResponse} - The deserialized result object. * * @reject {Error} - The error object. * @@ -7025,14 +6428,14 @@ class NetworkWatchers { * {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 QueryConnectionMonitorsResponse} for more - * information. + * See {@link NetworkConfigurationDiagnosticResponse} 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. */ - queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { + getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -7041,14 +6444,14 @@ class NetworkWatchers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { if (err) { reject(err); } else { resolve(result); } return; }); }); } else { - return self._queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + return self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); } } @@ -8505,275 +7908,6 @@ class NetworkWatchers { } } - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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. - */ - beginQueryConnectionMonitorsWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Query connection monitors. - * - * @param {string} resourceGroupName The name of the resource group. - * - * @param {string} networkWatcherName The name of the network watcher. - * - * @param {object} parameters Parameters to get network configuration - * diagnostic. - * - * @param {array} [parameters.connectionMonitorIds] List of connection monitors - * ID. - * - * @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 {QueryConnectionMonitorsResponse} - 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 QueryConnectionMonitorsResponse} 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. - */ - beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, 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._beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); - } - } - - /** - * Query connection monitors. - * - * @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. - */ - queryConnectionMonitorsNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._queryConnectionMonitorsNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Query connection monitors. - * - * @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 {QueryConnectionMonitorsResponse} - 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 QueryConnectionMonitorsResponse} 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. - */ - queryConnectionMonitorsNext(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._queryConnectionMonitorsNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._queryConnectionMonitorsNext(nextPageLink, options, optionalCallback); - } - } - - /** - * Query connection monitors. - * - * @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. - */ - beginQueryConnectionMonitorsNextWithHttpOperationResponse(nextPageLink, options) { - let client = this.client; - let self = this; - return new Promise((resolve, reject) => { - self._beginQueryConnectionMonitorsNext(nextPageLink, options, (err, result, request, response) => { - let httpOperationResponse = new msRest.HttpOperationResponse(request, response); - httpOperationResponse.body = result; - if (err) { reject(err); } - else { resolve(httpOperationResponse); } - return; - }); - }); - } - - /** - * Query connection monitors. - * - * @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 {QueryConnectionMonitorsResponse} - 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 QueryConnectionMonitorsResponse} 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. - */ - beginQueryConnectionMonitorsNext(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._beginQueryConnectionMonitorsNext(nextPageLink, options, (err, result, request, response) => { - if (err) { reject(err); } - else { resolve(result); } - return; - }); - }); - } else { - return self._beginQueryConnectionMonitorsNext(nextPageLink, options, optionalCallback); - } - } - } module.exports = NetworkWatchers;