From db4a32c52332c1857a6caa2fd7a618706f8983ad Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 7 Aug 2018 18:53:20 +0000 Subject: [PATCH 1/6] Generated from 6ad7c8a080cf905ffcbe9c42c0382059ce753188 Added NetworkConfigurationDiagnostic rest API + example --- .../models/evaluatedNetworkSecurityGroup.js | 85 ++++ .../networkManagement2/lib/models/index.d.ts | 165 ++++++ .../networkManagement2/lib/models/index.js | 8 + .../lib/models/matchedRule.js | 61 +++ ...etworkConfigurationDiagnosticParameters.js | 73 +++ .../networkConfigurationDiagnosticResponse.js | 64 +++ .../networkConfigurationDiagnosticResult.js | 83 +++ .../lib/models/networkSecurityGroupResult.js | 74 +++ .../networkSecurityRulesEvaluationResult.js | 97 ++++ .../lib/models/trafficQuery.js | 91 ++++ .../lib/operations/index.d.ts | 148 ++++++ .../lib/operations/networkWatchers.js | 475 ++++++++++++++++++ 12 files changed, 1424 insertions(+) create mode 100644 lib/services/networkManagement2/lib/models/evaluatedNetworkSecurityGroup.js create mode 100644 lib/services/networkManagement2/lib/models/matchedRule.js create mode 100644 lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js create mode 100644 lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResponse.js create mode 100644 lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResult.js create mode 100644 lib/services/networkManagement2/lib/models/networkSecurityGroupResult.js create mode 100644 lib/services/networkManagement2/lib/models/networkSecurityRulesEvaluationResult.js create mode 100644 lib/services/networkManagement2/lib/models/trafficQuery.js diff --git a/lib/services/networkManagement2/lib/models/evaluatedNetworkSecurityGroup.js b/lib/services/networkManagement2/lib/models/evaluatedNetworkSecurityGroup.js new file mode 100644 index 0000000000..9f82902ea9 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/evaluatedNetworkSecurityGroup.js @@ -0,0 +1,85 @@ +/* + * 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'); + +/** + * Results of network security group evaluation. + * + */ +class EvaluatedNetworkSecurityGroup { + /** + * Create a EvaluatedNetworkSecurityGroup. + * @member {string} [networkSecurityGroupId] Network security group ID. + * @member {object} [matchedRule] + * @member {string} [matchedRule.ruleName] Name of the matched network + * security rule. + * @member {string} [matchedRule.action] The network traffic is allowed or + * denied. Possible values are 'Allow' and 'Deny'. + * @member {array} [rulesEvaluationResult] List of network security rules + * evaluation results. + */ + constructor() { + } + + /** + * Defines the metadata of EvaluatedNetworkSecurityGroup + * + * @returns {object} metadata of EvaluatedNetworkSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'EvaluatedNetworkSecurityGroup', + type: { + name: 'Composite', + className: 'EvaluatedNetworkSecurityGroup', + modelProperties: { + networkSecurityGroupId: { + required: false, + serializedName: 'networkSecurityGroupId', + type: { + name: 'String' + } + }, + matchedRule: { + required: false, + serializedName: 'matchedRule', + type: { + name: 'Composite', + className: 'MatchedRule' + } + }, + rulesEvaluationResult: { + required: false, + readOnly: true, + serializedName: 'rulesEvaluationResult', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkSecurityRulesEvaluationResultElementType', + type: { + name: 'Composite', + className: 'NetworkSecurityRulesEvaluationResult' + } + } + } + } + } + } + }; + } +} + +module.exports = EvaluatedNetworkSecurityGroup; diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index dc2fde51e5..d2ff032233 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5376,6 +5376,171 @@ export interface ConnectionMonitorQueryResult { states?: ConnectionStateSnapshot[]; } +/** + * @class + * Initializes a new instance of the TrafficQuery class. + * @constructor + * Parameters to compare with network configuration. + * + * @member {string} direction The direction of the traffic. Accepted values are + * 'Inbound' and 'Outbound'. Possible values include: 'Inbound', 'Outbound' + * @member {string} protocol Protocol to be verified on. Accepted values are + * '*', TCP, UDP. + * @member {string} source Traffic source. Accepted values are '*', IP + * Address/CIDR, Service Tag. + * @member {string} destination Traffic destination. Accepted values are: '*', + * IP Address/CIDR, Service Tag. + * @member {string} destinationPort Traffice destination port. Accepted values + * are '*', port (for example, 3389) and port range (for example, 80-100). + */ +export interface TrafficQuery { + direction: string; + protocol: string; + source: string; + destination: string; + destinationPort: string; +} + +/** + * @class + * Initializes a new instance of the NetworkConfigurationDiagnosticParameters class. + * @constructor + * Parameters to get network configuration diagnostic. + * + * @member {string} targetResourceId The ID of the target resource to perform + * network configuration diagnostic. Valid options are VM, NetworkInterface, + * VMSS/NetworkInterface and Application Gateway. + * @member {array} queries List of traffic queries. + */ +export interface NetworkConfigurationDiagnosticParameters { + targetResourceId: string; + readonly queries: TrafficQuery[]; +} + +/** + * @class + * Initializes a new instance of the MatchedRule class. + * @constructor + * Matched rule. + * + * @member {string} [ruleName] Name of the matched network security rule. + * @member {string} [action] The network traffic is allowed or denied. Possible + * values are 'Allow' and 'Deny'. + */ +export interface MatchedRule { + ruleName?: string; + action?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkSecurityRulesEvaluationResult class. + * @constructor + * Network security rules evaluation result. + * + * @member {string} [name] Name of the network security rule. + * @member {boolean} [protocolMatched] Value indicating whether protocol is + * matched. + * @member {boolean} [sourceMatched] Value indicating whether source is + * matched. + * @member {boolean} [sourcePortMatched] Value indicating whether source port + * is matched. + * @member {boolean} [destinationMatched] Value indicating whether destination + * is matched. + * @member {boolean} [destinationPortMatched] Value indicating whether + * destination port is matched. + */ +export interface NetworkSecurityRulesEvaluationResult { + name?: string; + protocolMatched?: boolean; + sourceMatched?: boolean; + sourcePortMatched?: boolean; + destinationMatched?: boolean; + destinationPortMatched?: boolean; +} + +/** + * @class + * Initializes a new instance of the EvaluatedNetworkSecurityGroup class. + * @constructor + * Results of network security group evaluation. + * + * @member {string} [networkSecurityGroupId] Network security group ID. + * @member {object} [matchedRule] + * @member {string} [matchedRule.ruleName] Name of the matched network security + * rule. + * @member {string} [matchedRule.action] The network traffic is allowed or + * denied. Possible values are 'Allow' and 'Deny'. + * @member {array} [rulesEvaluationResult] List of network security rules + * evaluation results. + */ +export interface EvaluatedNetworkSecurityGroup { + networkSecurityGroupId?: string; + matchedRule?: MatchedRule; + readonly rulesEvaluationResult?: NetworkSecurityRulesEvaluationResult[]; +} + +/** + * @class + * Initializes a new instance of the NetworkSecurityGroupResult class. + * @constructor + * Network configuration diagnostic result corresponded provided traffic query. + * + * @member {string} [securityRuleAccessResult] The network traffic is allowed + * or denied. Possible values are 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * @member {array} [evaluatedNetworkSecurityGroups] List of results network + * security groups diagnostic. + */ +export interface NetworkSecurityGroupResult { + securityRuleAccessResult?: string; + readonly evaluatedNetworkSecurityGroups?: EvaluatedNetworkSecurityGroup[]; +} + +/** + * @class + * Initializes a new instance of the NetworkConfigurationDiagnosticResult class. + * @constructor + * Network configuration diagnostic result corresponded to provided traffic + * query. + * + * @member {object} [trafficQuery] + * @member {string} [trafficQuery.direction] The direction of the traffic. + * Accepted values are 'Inbound' and 'Outbound'. Possible values include: + * 'Inbound', 'Outbound' + * @member {string} [trafficQuery.protocol] Protocol to be verified on. + * Accepted values are '*', TCP, UDP. + * @member {string} [trafficQuery.source] Traffic source. Accepted values are + * '*', IP Address/CIDR, Service Tag. + * @member {string} [trafficQuery.destination] Traffic destination. Accepted + * values are: '*', IP Address/CIDR, Service Tag. + * @member {string} [trafficQuery.destinationPort] Traffice destination port. + * Accepted values are '*', port (for example, 3389) and port range (for + * example, 80-100). + * @member {object} [networkSecurityGroupResult] + * @member {string} [networkSecurityGroupResult.securityRuleAccessResult] The + * network traffic is allowed or denied. Possible values are 'Allow' and + * 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} [networkSecurityGroupResult.evaluatedNetworkSecurityGroups] + * List of results network security groups diagnostic. + */ +export interface NetworkConfigurationDiagnosticResult { + trafficQuery?: TrafficQuery; + networkSecurityGroupResult?: NetworkSecurityGroupResult; +} + +/** + * @class + * Initializes a new instance of the NetworkConfigurationDiagnosticResponse class. + * @constructor + * Results of network configuration diagnostic on the target resource. + * + * @member {array} [results] List of network configuration diagnostic results. + */ +export interface NetworkConfigurationDiagnosticResponse { + readonly results?: NetworkConfigurationDiagnosticResult[]; +} + /** * @class * Initializes a new instance of the OperationDisplay class. diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index bd50b1261c..d52ed7bed4 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -180,6 +180,14 @@ exports.ConnectionMonitor = require('./connectionMonitor'); exports.ConnectionMonitorResult = require('./connectionMonitorResult'); exports.ConnectionStateSnapshot = require('./connectionStateSnapshot'); exports.ConnectionMonitorQueryResult = require('./connectionMonitorQueryResult'); +exports.TrafficQuery = require('./trafficQuery'); +exports.NetworkConfigurationDiagnosticParameters = require('./networkConfigurationDiagnosticParameters'); +exports.MatchedRule = require('./matchedRule'); +exports.NetworkSecurityRulesEvaluationResult = require('./networkSecurityRulesEvaluationResult'); +exports.EvaluatedNetworkSecurityGroup = require('./evaluatedNetworkSecurityGroup'); +exports.NetworkSecurityGroupResult = require('./networkSecurityGroupResult'); +exports.NetworkConfigurationDiagnosticResult = require('./networkConfigurationDiagnosticResult'); +exports.NetworkConfigurationDiagnosticResponse = require('./networkConfigurationDiagnosticResponse'); exports.OperationDisplay = require('./operationDisplay'); exports.Availability = require('./availability'); exports.Dimension = require('./dimension'); diff --git a/lib/services/networkManagement2/lib/models/matchedRule.js b/lib/services/networkManagement2/lib/models/matchedRule.js new file mode 100644 index 0000000000..ec9d7d44cd --- /dev/null +++ b/lib/services/networkManagement2/lib/models/matchedRule.js @@ -0,0 +1,61 @@ +/* + * 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'; + +/** + * Matched rule. + * + */ +class MatchedRule { + /** + * Create a MatchedRule. + * @member {string} [ruleName] Name of the matched network security rule. + * @member {string} [action] The network traffic is allowed or denied. + * Possible values are 'Allow' and 'Deny'. + */ + constructor() { + } + + /** + * Defines the metadata of MatchedRule + * + * @returns {object} metadata of MatchedRule + * + */ + mapper() { + return { + required: false, + serializedName: 'MatchedRule', + type: { + name: 'Composite', + className: 'MatchedRule', + modelProperties: { + ruleName: { + required: false, + serializedName: 'ruleName', + type: { + name: 'String' + } + }, + action: { + required: false, + serializedName: 'action', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MatchedRule; diff --git a/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js new file mode 100644 index 0000000000..dc8d4e0dc6 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js @@ -0,0 +1,73 @@ +/* + * 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'); + +/** + * Parameters to get network configuration diagnostic. + * + */ +class NetworkConfigurationDiagnosticParameters { + /** + * Create a NetworkConfigurationDiagnosticParameters. + * @member {string} targetResourceId The ID of the target resource to perform + * network configuration diagnostic. Valid options are VM, NetworkInterface, + * VMSS/NetworkInterface and Application Gateway. + * @member {array} queries List of traffic queries. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkConfigurationDiagnosticParameters + * + * @returns {object} metadata of NetworkConfigurationDiagnosticParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkConfigurationDiagnosticParameters', + type: { + name: 'Composite', + className: 'NetworkConfigurationDiagnosticParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + }, + queries: { + required: true, + readOnly: true, + serializedName: 'queries', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TrafficQueryElementType', + type: { + name: 'Composite', + className: 'TrafficQuery' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkConfigurationDiagnosticParameters; diff --git a/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResponse.js b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResponse.js new file mode 100644 index 0000000000..1b6db15851 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResponse.js @@ -0,0 +1,64 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Results of network configuration diagnostic on the target resource. + * + */ +class NetworkConfigurationDiagnosticResponse { + /** + * Create a NetworkConfigurationDiagnosticResponse. + * @member {array} [results] List of network configuration diagnostic + * results. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkConfigurationDiagnosticResponse + * + * @returns {object} metadata of NetworkConfigurationDiagnosticResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkConfigurationDiagnosticResponse', + type: { + name: 'Composite', + className: 'NetworkConfigurationDiagnosticResponse', + modelProperties: { + results: { + required: false, + readOnly: true, + serializedName: 'results', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkConfigurationDiagnosticResultElementType', + type: { + name: 'Composite', + className: 'NetworkConfigurationDiagnosticResult' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkConfigurationDiagnosticResponse; diff --git a/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResult.js b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResult.js new file mode 100644 index 0000000000..b5fb39e166 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticResult.js @@ -0,0 +1,83 @@ +/* + * 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'); + +/** + * Network configuration diagnostic result corresponded to provided traffic + * query. + * + */ +class NetworkConfigurationDiagnosticResult { + /** + * Create a NetworkConfigurationDiagnosticResult. + * @member {object} [trafficQuery] + * @member {string} [trafficQuery.direction] The direction of the traffic. + * Accepted values are 'Inbound' and 'Outbound'. Possible values include: + * 'Inbound', 'Outbound' + * @member {string} [trafficQuery.protocol] Protocol to be verified on. + * Accepted values are '*', TCP, UDP. + * @member {string} [trafficQuery.source] Traffic source. Accepted values are + * '*', IP Address/CIDR, Service Tag. + * @member {string} [trafficQuery.destination] Traffic destination. Accepted + * values are: '*', IP Address/CIDR, Service Tag. + * @member {string} [trafficQuery.destinationPort] Traffice destination port. + * Accepted values are '*', port (for example, 3389) and port range (for + * example, 80-100). + * @member {object} [networkSecurityGroupResult] + * @member {string} [networkSecurityGroupResult.securityRuleAccessResult] The + * network traffic is allowed or denied. Possible values are 'Allow' and + * 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} + * [networkSecurityGroupResult.evaluatedNetworkSecurityGroups] List of + * results network security groups diagnostic. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkConfigurationDiagnosticResult + * + * @returns {object} metadata of NetworkConfigurationDiagnosticResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkConfigurationDiagnosticResult', + type: { + name: 'Composite', + className: 'NetworkConfigurationDiagnosticResult', + modelProperties: { + trafficQuery: { + required: false, + serializedName: 'trafficQuery', + type: { + name: 'Composite', + className: 'TrafficQuery' + } + }, + networkSecurityGroupResult: { + required: false, + serializedName: 'networkSecurityGroupResult', + type: { + name: 'Composite', + className: 'NetworkSecurityGroupResult' + } + } + } + } + }; + } +} + +module.exports = NetworkConfigurationDiagnosticResult; diff --git a/lib/services/networkManagement2/lib/models/networkSecurityGroupResult.js b/lib/services/networkManagement2/lib/models/networkSecurityGroupResult.js new file mode 100644 index 0000000000..3157a203fe --- /dev/null +++ b/lib/services/networkManagement2/lib/models/networkSecurityGroupResult.js @@ -0,0 +1,74 @@ +/* + * 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'); + +/** + * Network configuration diagnostic result corresponded provided traffic query. + * + */ +class NetworkSecurityGroupResult { + /** + * Create a NetworkSecurityGroupResult. + * @member {string} [securityRuleAccessResult] The network traffic is allowed + * or denied. Possible values are 'Allow' and 'Deny'. Possible values + * include: 'Allow', 'Deny' + * @member {array} [evaluatedNetworkSecurityGroups] List of results network + * security groups diagnostic. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkSecurityGroupResult + * + * @returns {object} metadata of NetworkSecurityGroupResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkSecurityGroupResult', + type: { + name: 'Composite', + className: 'NetworkSecurityGroupResult', + modelProperties: { + securityRuleAccessResult: { + required: false, + serializedName: 'securityRuleAccessResult', + type: { + name: 'String' + } + }, + evaluatedNetworkSecurityGroups: { + required: false, + readOnly: true, + serializedName: 'evaluatedNetworkSecurityGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EvaluatedNetworkSecurityGroupElementType', + type: { + name: 'Composite', + className: 'EvaluatedNetworkSecurityGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkSecurityGroupResult; diff --git a/lib/services/networkManagement2/lib/models/networkSecurityRulesEvaluationResult.js b/lib/services/networkManagement2/lib/models/networkSecurityRulesEvaluationResult.js new file mode 100644 index 0000000000..86f808efb3 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/networkSecurityRulesEvaluationResult.js @@ -0,0 +1,97 @@ +/* + * 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'; + +/** + * Network security rules evaluation result. + * + */ +class NetworkSecurityRulesEvaluationResult { + /** + * Create a NetworkSecurityRulesEvaluationResult. + * @member {string} [name] Name of the network security rule. + * @member {boolean} [protocolMatched] Value indicating whether protocol is + * matched. + * @member {boolean} [sourceMatched] Value indicating whether source is + * matched. + * @member {boolean} [sourcePortMatched] Value indicating whether source port + * is matched. + * @member {boolean} [destinationMatched] Value indicating whether + * destination is matched. + * @member {boolean} [destinationPortMatched] Value indicating whether + * destination port is matched. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkSecurityRulesEvaluationResult + * + * @returns {object} metadata of NetworkSecurityRulesEvaluationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkSecurityRulesEvaluationResult', + type: { + name: 'Composite', + className: 'NetworkSecurityRulesEvaluationResult', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + protocolMatched: { + required: false, + serializedName: 'protocolMatched', + type: { + name: 'Boolean' + } + }, + sourceMatched: { + required: false, + serializedName: 'sourceMatched', + type: { + name: 'Boolean' + } + }, + sourcePortMatched: { + required: false, + serializedName: 'sourcePortMatched', + type: { + name: 'Boolean' + } + }, + destinationMatched: { + required: false, + serializedName: 'destinationMatched', + type: { + name: 'Boolean' + } + }, + destinationPortMatched: { + required: false, + serializedName: 'destinationPortMatched', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = NetworkSecurityRulesEvaluationResult; diff --git a/lib/services/networkManagement2/lib/models/trafficQuery.js b/lib/services/networkManagement2/lib/models/trafficQuery.js new file mode 100644 index 0000000000..29bbed73ae --- /dev/null +++ b/lib/services/networkManagement2/lib/models/trafficQuery.js @@ -0,0 +1,91 @@ +/* + * 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'; + +/** + * Parameters to compare with network configuration. + * + */ +class TrafficQuery { + /** + * Create a TrafficQuery. + * @member {string} direction The direction of the traffic. Accepted values + * are 'Inbound' and 'Outbound'. Possible values include: 'Inbound', + * 'Outbound' + * @member {string} protocol Protocol to be verified on. Accepted values are + * '*', TCP, UDP. + * @member {string} source Traffic source. Accepted values are '*', IP + * Address/CIDR, Service Tag. + * @member {string} destination Traffic destination. Accepted values are: + * '*', IP Address/CIDR, Service Tag. + * @member {string} destinationPort Traffice destination port. Accepted + * values are '*', port (for example, 3389) and port range (for example, + * 80-100). + */ + constructor() { + } + + /** + * Defines the metadata of TrafficQuery + * + * @returns {object} metadata of TrafficQuery + * + */ + mapper() { + return { + required: false, + serializedName: 'TrafficQuery', + type: { + name: 'Composite', + className: 'TrafficQuery', + modelProperties: { + direction: { + required: true, + serializedName: 'direction', + type: { + name: 'String' + } + }, + protocol: { + required: true, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + source: { + required: true, + serializedName: 'source', + type: { + name: 'String' + } + }, + destination: { + required: true, + serializedName: 'destination', + type: { + name: 'String' + } + }, + destinationPort: { + required: true, + serializedName: 'destinationPort', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TrafficQuery; diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index 1b50dafa65..3aa65de67e 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -16940,6 +16940,80 @@ export interface NetworkWatchers { listAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + /** + * 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 {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. + */ + getNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * 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 {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 {NetworkConfigurationDiagnosticResponse} - 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. + * + * {NetworkConfigurationDiagnosticResponse} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkConfigurationDiagnosticResponse} 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. + */ + getNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, callback: ServiceCallback): void; + getNetworkConfigurationDiagnostic(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + /** * Deletes the specified network watcher resource. * @@ -17989,6 +18063,80 @@ export interface NetworkWatchers { beginListAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; beginListAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, callback: ServiceCallback): void; beginListAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * 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 {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. + */ + beginGetNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkConfigurationDiagnosticParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * 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 {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 {NetworkConfigurationDiagnosticResponse} - 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. + * + * {NetworkConfigurationDiagnosticResponse} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkConfigurationDiagnosticResponse} 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. + */ + 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; } /** diff --git a/lib/services/networkManagement2/lib/operations/networkWatchers.js b/lib/services/networkManagement2/lib/operations/networkWatchers.js index c744d25aae..0da2f64b7e 100644 --- a/lib/services/networkManagement2/lib/operations/networkWatchers.js +++ b/lib/services/networkManagement2/lib/operations/networkWatchers.js @@ -2002,6 +2002,92 @@ function _listAvailableProviders(resourceGroupName, networkWatcherName, paramete }); } + +/** + * 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 {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 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. + */ +function _getNetworkConfigurationDiagnostic(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.beginGetNetworkConfigurationDiagnostic(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['NetworkConfigurationDiagnosticResponse']().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. * @@ -4101,6 +4187,191 @@ function _beginListAvailableProviders(resourceGroupName, networkWatcherName, par }); } +/** + * 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 {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 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. + */ +function _beginGetNetworkConfigurationDiagnostic(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-06-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); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/networkConfigurationDiagnostic'; + 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['NetworkConfigurationDiagnosticParameters']().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) { + 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['NetworkConfigurationDiagnosticResponse']().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['NetworkConfigurationDiagnosticResponse']().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 { /** @@ -4126,6 +4397,7 @@ class NetworkWatchers { this._checkConnectivity = _checkConnectivity; this._getAzureReachabilityReport = _getAzureReachabilityReport; this._listAvailableProviders = _listAvailableProviders; + this._getNetworkConfigurationDiagnostic = _getNetworkConfigurationDiagnostic; this._beginDeleteMethod = _beginDeleteMethod; this._beginVerifyIPFlow = _beginVerifyIPFlow; this._beginGetNextHop = _beginGetNextHop; @@ -4137,6 +4409,7 @@ class NetworkWatchers { this._beginCheckConnectivity = _beginCheckConnectivity; this._beginGetAzureReachabilityReport = _beginGetAzureReachabilityReport; this._beginListAvailableProviders = _beginListAvailableProviders; + this._beginGetNetworkConfigurationDiagnostic = _beginGetNetworkConfigurationDiagnostic; } /** @@ -6055,6 +6328,107 @@ class NetworkWatchers { } } + /** + * 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 {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 {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. + * + * {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) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._getNetworkConfigurationDiagnostic(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); + } + } + /** * Deletes the specified network watcher resource. * @@ -7403,6 +7777,107 @@ class NetworkWatchers { } } + /** + * 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 {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. + */ + beginGetNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetNetworkConfigurationDiagnostic(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 {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. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginGetNetworkConfigurationDiagnostic(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._beginGetNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + } module.exports = NetworkWatchers; From 744f058b956979a4ed84097bdfd25c3edbd8cae8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 7 Aug 2018 21:21:31 +0000 Subject: [PATCH 2/6] Generated from 6909b52c5e23056444d410930b8702e7540811e2 Removed 'read-only' from queries in NetworkConfigurationDiagnostic API --- .../networkManagement2/lib/models/index.d.ts | 2 +- .../networkConfigurationDiagnosticParameters.js | 1 - .../networkManagement2/lib/operations/index.d.ts | 8 ++++++++ .../lib/operations/networkWatchers.js | 12 ++++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index d2ff032233..dda0ea629c 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5414,7 +5414,7 @@ export interface TrafficQuery { */ export interface NetworkConfigurationDiagnosticParameters { targetResourceId: string; - readonly queries: TrafficQuery[]; + queries: TrafficQuery[]; } /** diff --git a/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js index dc8d4e0dc6..d8b7285f4f 100644 --- a/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js +++ b/lib/services/networkManagement2/lib/models/networkConfigurationDiagnosticParameters.js @@ -50,7 +50,6 @@ class NetworkConfigurationDiagnosticParameters { }, queries: { required: true, - readOnly: true, serializedName: 'queries', type: { name: 'Sequence', diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index 3aa65de67e..9ed1016140 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -16954,6 +16954,8 @@ export interface NetworkWatchers { * 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 @@ -16981,6 +16983,8 @@ export interface NetworkWatchers { * 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 @@ -18079,6 +18083,8 @@ export interface NetworkWatchers { * 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 @@ -18106,6 +18112,8 @@ export interface NetworkWatchers { * 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 diff --git a/lib/services/networkManagement2/lib/operations/networkWatchers.js b/lib/services/networkManagement2/lib/operations/networkWatchers.js index 0da2f64b7e..bcba2307b6 100644 --- a/lib/services/networkManagement2/lib/operations/networkWatchers.js +++ b/lib/services/networkManagement2/lib/operations/networkWatchers.js @@ -2017,6 +2017,8 @@ function _listAvailableProviders(resourceGroupName, networkWatcherName, paramete * 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 @@ -4201,6 +4203,8 @@ function _beginListAvailableProviders(resourceGroupName, networkWatcherName, par * 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 @@ -6342,6 +6346,8 @@ class NetworkWatchers { * 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 @@ -6381,6 +6387,8 @@ class NetworkWatchers { * 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 @@ -7791,6 +7799,8 @@ class NetworkWatchers { * 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 @@ -7830,6 +7840,8 @@ class NetworkWatchers { * 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 From 09324485ece64efb4444b958626b42c8fd3ed16a Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Sat, 11 Aug 2018 17:12:05 +0000 Subject: [PATCH 3/6] Generated from f12e6b41326c05506097b75dce076c297074a3d2 Fixed example name --- .../connectionMonitorsQueryResultItem.js | 70 + .../networkManagement2/lib/models/index.d.ts | 38 + .../networkManagement2/lib/models/index.js | 3 + .../queryConnectionMonitorsParameters.js | 59 + .../models/queryConnectionMonitorsResponse.js | 67 + .../lib/operations/index.d.ts | 260 ++++ .../lib/operations/networkWatchers.js | 1136 +++++++++++++++-- 7 files changed, 1497 insertions(+), 136 deletions(-) create mode 100644 lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js create mode 100644 lib/services/networkManagement2/lib/models/queryConnectionMonitorsParameters.js create mode 100644 lib/services/networkManagement2/lib/models/queryConnectionMonitorsResponse.js diff --git a/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js b/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js new file mode 100644 index 0000000000..d71652d230 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Results of query particular connection monitor. + * + */ +class ConnectionMonitorsQueryResultItem { + /** + * Create a ConnectionMonitorsQueryResultItem. + * @member {string} [resourceId] Connection monitor resource ID. + * @member {array} [report] List of connection monitors query results. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitorsQueryResultItem + * + * @returns {object} metadata of ConnectionMonitorsQueryResultItem + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorsQueryResultItem', + type: { + name: 'Composite', + className: 'ConnectionMonitorsQueryResultItem', + modelProperties: { + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + report: { + required: false, + serializedName: 'report', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionMonitorQueryResultElementType', + type: { + name: 'Composite', + className: 'ConnectionMonitorQueryResult' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorsQueryResultItem; diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index dda0ea629c..47721e6837 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5541,6 +5541,32 @@ 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 {array} [report] List of connection monitors query results. + */ +export interface ConnectionMonitorsQueryResultItem { + resourceId?: string; + report?: ConnectionMonitorQueryResult[]; +} + /** * @class * Initializes a new instance of the OperationDisplay class. @@ -7366,6 +7392,18 @@ 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 d52ed7bed4..74eaae56e6 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -188,6 +188,8 @@ 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'); @@ -264,6 +266,7 @@ 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/queryConnectionMonitorsParameters.js b/lib/services/networkManagement2/lib/models/queryConnectionMonitorsParameters.js new file mode 100644 index 0000000000..f5535cec59 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/queryConnectionMonitorsParameters.js @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters to query connection monitors. + * + */ +class QueryConnectionMonitorsParameters { + /** + * Create a QueryConnectionMonitorsParameters. + * @member {array} [connectionMonitorIds] List of connection monitors ID. + */ + constructor() { + } + + /** + * Defines the metadata of QueryConnectionMonitorsParameters + * + * @returns {object} metadata of QueryConnectionMonitorsParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'QueryConnectionMonitorsParameters', + type: { + name: 'Composite', + className: 'QueryConnectionMonitorsParameters', + modelProperties: { + connectionMonitorIds: { + required: false, + serializedName: 'connectionMonitorIds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = QueryConnectionMonitorsParameters; diff --git a/lib/services/networkManagement2/lib/models/queryConnectionMonitorsResponse.js b/lib/services/networkManagement2/lib/models/queryConnectionMonitorsResponse.js new file mode 100644 index 0000000000..8ac61e32ac --- /dev/null +++ b/lib/services/networkManagement2/lib/models/queryConnectionMonitorsResponse.js @@ -0,0 +1,67 @@ +/* + * 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'; + +/** + * Results of query connection monitors. + */ +class QueryConnectionMonitorsResponse extends Array { + /** + * Create a QueryConnectionMonitorsResponse. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of QueryConnectionMonitorsResponse + * + * @returns {object} metadata of QueryConnectionMonitorsResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'QueryConnectionMonitorsResponse', + type: { + name: 'Composite', + className: 'QueryConnectionMonitorsResponse', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionMonitorsQueryResultItemElementType', + type: { + name: 'Composite', + className: 'ConnectionMonitorsQueryResultItem' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = QueryConnectionMonitorsResponse; diff --git a/lib/services/networkManagement2/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/operations/index.d.ts index 9ed1016140..4362865f0f 100644 --- a/lib/services/networkManagement2/lib/operations/index.d.ts +++ b/lib/services/networkManagement2/lib/operations/index.d.ts @@ -17018,6 +17018,78 @@ 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. * @@ -18145,6 +18217,194 @@ 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/networkWatchers.js b/lib/services/networkManagement2/lib/operations/networkWatchers.js index bcba2307b6..12dc50e2f4 100644 --- a/lib/services/networkManagement2/lib/operations/networkWatchers.js +++ b/lib/services/networkManagement2/lib/operations/networkWatchers.js @@ -2090,6 +2090,91 @@ 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. * @@ -4376,122 +4461,533 @@ function _beginGetNetworkConfigurationDiagnostic(resourceGroupName, networkWatch }); } -/** 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; +/** + * 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-06-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); } - /** - * 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; - }); - }); + // 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('&'); } - /** - * 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 - * - * @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 {NetworkWatcher} - The deserialized result object. + // 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) { + 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['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) { + 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['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 + * + * @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 {NetworkWatcher} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6312,7 +6808,112 @@ class NetworkWatchers { * * {stream} [response] - The HTTP Response stream if an error did not occur. */ - listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { + 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. + * + * {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) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6321,19 +6922,19 @@ class NetworkWatchers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._listAvailableProviders(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._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + return self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); } } /** - * Get network configuration diagnostic. + * Query connection monitors. * * @param {string} resourceGroupName The name of the resource group. * @@ -6342,11 +6943,8 @@ class NetworkWatchers { * @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 {array} [parameters.connectionMonitorIds] List of connection monitors + * ID. * * @param {object} [options] Optional Parameters. * @@ -6355,15 +6953,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. */ - getNetworkConfigurationDiagnosticWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + queryConnectionMonitorsWithHttpOperationResponse(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) => { + self._queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { let httpOperationResponse = new msRest.HttpOperationResponse(request, response); httpOperationResponse.body = result; if (err) { reject(err); } @@ -6374,7 +6972,7 @@ class NetworkWatchers { } /** - * Get network configuration diagnostic. + * Query connection monitors. * * @param {string} resourceGroupName The name of the resource group. * @@ -6383,11 +6981,8 @@ class NetworkWatchers { * @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 {array} [parameters.connectionMonitorIds] List of connection monitors + * ID. * * @param {object} [options] Optional Parameters. * @@ -6401,7 +6996,7 @@ class NetworkWatchers { * * {Promise} A promise is returned * - * @resolve {NetworkConfigurationDiagnosticResponse} - The deserialized result object. + * @resolve {QueryConnectionMonitorsResponse} - The deserialized result object. * * @reject {Error} - The error object. * @@ -6410,14 +7005,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 NetworkConfigurationDiagnosticResponse} for - * more information. + * 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. */ - getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { + queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { let client = this.client; let self = this; if (!optionalCallback && typeof options === 'function') { @@ -6426,14 +7021,14 @@ class NetworkWatchers { } if (!optionalCallback) { return new Promise((resolve, reject) => { - self._getNetworkConfigurationDiagnostic(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + self._queryConnectionMonitors(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._queryConnectionMonitors(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); } } @@ -7890,6 +8485,275 @@ 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; From 9a08d880b1ce25eb6b3087ff12ecd2b01a8702fe Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 14 Aug 2018 06:18:25 +0000 Subject: [PATCH 4/6] Generated from 9e5daf5f1cd3c59140eec06d6fb55e6456323c54 Fixed reference to ErrorDetails --- .../lib/models/errorResponse.js | 58 ++++++ .../networkManagement2/lib/models/index.d.ts | 15 ++ .../networkManagement2/lib/models/index.js | 1 + .../lib/operations/connectionMonitors.js | 63 +++--- .../lib/operations/networkWatchers.js | 180 ++++++++++-------- .../lib/operations/packetCaptures.js | 54 +++--- 6 files changed, 239 insertions(+), 132 deletions(-) create mode 100644 lib/services/networkManagement2/lib/models/errorResponse.js diff --git a/lib/services/networkManagement2/lib/models/errorResponse.js b/lib/services/networkManagement2/lib/models/errorResponse.js new file mode 100644 index 0000000000..89e4677830 --- /dev/null +++ b/lib/services/networkManagement2/lib/models/errorResponse.js @@ -0,0 +1,58 @@ +/* + * 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'); + +/** + * The error object. + * + */ +class ErrorResponse { + /** + * Create a ErrorResponse. + * @member {object} [error] Error. + * @member {string} [error.code] + * @member {string} [error.target] + * @member {string} [error.message] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorResponse + * + * @returns {object} metadata of ErrorResponse + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorResponse', + type: { + name: 'Composite', + className: 'ErrorResponse', + modelProperties: { + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorDetails' + } + } + } + } + }; + } +} + +module.exports = ErrorResponse; diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index 47721e6837..914633884e 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -4137,6 +4137,21 @@ export interface EffectiveRouteListResult { readonly nextLink?: string; } +/** + * @class + * Initializes a new instance of the ErrorResponse class. + * @constructor + * The error object. + * + * @member {object} [error] Error. + * @member {string} [error.code] + * @member {string} [error.target] + * @member {string} [error.message] + */ +export interface ErrorResponse { + error?: ErrorDetails; +} + /** * @class * Initializes a new instance of the NetworkWatcher class. diff --git a/lib/services/networkManagement2/lib/models/index.js b/lib/services/networkManagement2/lib/models/index.js index 74eaae56e6..a83ece2d6b 100644 --- a/lib/services/networkManagement2/lib/models/index.js +++ b/lib/services/networkManagement2/lib/models/index.js @@ -123,6 +123,7 @@ exports.EffectiveNetworkSecurityGroup = require('./effectiveNetworkSecurityGroup exports.EffectiveNetworkSecurityGroupListResult = require('./effectiveNetworkSecurityGroupListResult'); exports.EffectiveRoute = require('./effectiveRoute'); exports.EffectiveRouteListResult = require('./effectiveRouteListResult'); +exports.ErrorResponse = require('./errorResponse'); exports.NetworkWatcher = require('./networkWatcher'); exports.TopologyParameters = require('./topologyParameters'); exports.TopologyAssociation = require('./topologyAssociation'); diff --git a/lib/services/networkManagement2/lib/operations/connectionMonitors.js b/lib/services/networkManagement2/lib/operations/connectionMonitors.js index a8ea0a1960..2f872d65be 100644 --- a/lib/services/networkManagement2/lib/operations/connectionMonitors.js +++ b/lib/services/networkManagement2/lib/operations/connectionMonitors.js @@ -239,12 +239,13 @@ function _get(resourceGroupName, networkWatcherName, connectionMonitorName, opti 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -665,12 +666,13 @@ function _list(resourceGroupName, networkWatcherName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -865,12 +867,13 @@ function _beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionM 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1031,12 +1034,13 @@ function _beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMon 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1163,12 +1167,13 @@ function _beginStop(resourceGroupName, networkWatcherName, connectionMonitorName 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1295,12 +1300,13 @@ function _beginStart(resourceGroupName, networkWatcherName, connectionMonitorNam 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1430,12 +1436,13 @@ function _beginQuery(resourceGroupName, networkWatcherName, connectionMonitorNam 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/networkManagement2/lib/operations/networkWatchers.js b/lib/services/networkManagement2/lib/operations/networkWatchers.js index 12dc50e2f4..268e14327c 100644 --- a/lib/services/networkManagement2/lib/operations/networkWatchers.js +++ b/lib/services/networkManagement2/lib/operations/networkWatchers.js @@ -146,12 +146,13 @@ function _createOrUpdate(resourceGroupName, networkWatcherName, parameters, opti 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -306,12 +307,13 @@ function _get(resourceGroupName, networkWatcherName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -534,12 +536,13 @@ function _updateTags(resourceGroupName, networkWatcherName, parameters, options, 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -672,12 +675,13 @@ function _list(resourceGroupName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -804,12 +808,13 @@ function _listAll(options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -978,12 +983,13 @@ function _getTopology(resourceGroupName, networkWatcherName, parameters, options 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -2277,12 +2283,13 @@ function _beginDeleteMethod(resourceGroupName, networkWatcherName, options, call 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -2452,12 +2459,13 @@ function _beginVerifyIPFlow(resourceGroupName, networkWatcherName, parameters, o 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -2643,12 +2651,13 @@ function _beginGetNextHop(resourceGroupName, networkWatcherName, parameters, opt 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -2826,12 +2835,13 @@ function _beginGetVMSecurityRules(resourceGroupName, networkWatcherName, paramet 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3015,12 +3025,13 @@ function _beginGetTroubleshooting(resourceGroupName, networkWatcherName, paramet 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3198,12 +3209,13 @@ function _beginGetTroubleshootingResult(resourceGroupName, networkWatcherName, p 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3417,12 +3429,13 @@ function _beginSetFlowLogConfiguration(resourceGroupName, networkWatcherName, pa 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3602,12 +3615,13 @@ function _beginGetFlowLogStatus(resourceGroupName, networkWatcherName, parameter 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -3822,12 +3836,13 @@ function _beginCheckConnectivity(resourceGroupName, networkWatcherName, paramete 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -4025,12 +4040,13 @@ function _beginGetAzureReachabilityReport(resourceGroupName, networkWatcherName, 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -4217,12 +4233,13 @@ function _beginListAvailableProviders(resourceGroupName, networkWatcherName, par 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -4404,12 +4421,13 @@ function _beginGetNetworkConfigurationDiagnostic(resourceGroupName, networkWatch 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -4588,12 +4606,13 @@ function _beginQueryConnectionMonitors(resourceGroupName, networkWatcherName, pa 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -4811,12 +4830,13 @@ function _beginQueryConnectionMonitorsNext(nextPageLink, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { diff --git a/lib/services/networkManagement2/lib/operations/packetCaptures.js b/lib/services/networkManagement2/lib/operations/packetCaptures.js index 089c5b1985..eb78788596 100644 --- a/lib/services/networkManagement2/lib/operations/packetCaptures.js +++ b/lib/services/networkManagement2/lib/operations/packetCaptures.js @@ -235,12 +235,13 @@ function _get(resourceGroupName, networkWatcherName, packetCaptureName, options, 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -591,12 +592,13 @@ function _list(resourceGroupName, networkWatcherName, options, callback) { 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -789,12 +791,13 @@ function _beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -937,12 +940,13 @@ function _beginDeleteMethod(resourceGroupName, networkWatcherName, packetCapture 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1068,12 +1072,13 @@ function _beginStop(resourceGroupName, networkWatcherName, packetCaptureName, op 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { @@ -1202,12 +1207,13 @@ function _beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureNam 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; + 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['CloudError']().mapper(); + let resultMapper = new client.models['ErrorResponse']().mapper(); error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); } } catch (defaultError) { From 92f4695840623f9acfa66ff1a5af5d12e5330b13 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 15 Aug 2018 18:24:06 +0000 Subject: [PATCH 5/6] Generated from 0858a238c818aa119584a9d61deddc2a26494de9 Fixed response for QueryConnectionMonitors API + fixed example --- .../models/connectionMonitorsQueryResultItem.js | 16 ++++++---------- .../networkManagement2/lib/models/index.d.ts | 7 +++++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js b/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js index d71652d230..6986e4f073 100644 --- a/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js +++ b/lib/services/networkManagement2/lib/models/connectionMonitorsQueryResultItem.js @@ -20,7 +20,10 @@ class ConnectionMonitorsQueryResultItem { /** * Create a ConnectionMonitorsQueryResultItem. * @member {string} [resourceId] Connection monitor resource ID. - * @member {array} [report] List of connection monitors query results. + * @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. */ constructor() { } @@ -50,15 +53,8 @@ class ConnectionMonitorsQueryResultItem { required: false, serializedName: 'report', type: { - name: 'Sequence', - element: { - required: false, - serializedName: 'ConnectionMonitorQueryResultElementType', - type: { - name: 'Composite', - className: 'ConnectionMonitorQueryResult' - } - } + name: 'Composite', + className: 'ConnectionMonitorQueryResult' } } } diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index 914633884e..c488750c0a 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5575,11 +5575,14 @@ export interface QueryConnectionMonitorsParameters { * Results of query particular connection monitor. * * @member {string} [resourceId] Connection monitor resource ID. - * @member {array} [report] List of connection monitors query results. + * @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[]; + report?: ConnectionMonitorQueryResult; } /** From a25964f3d23072b4331528d26bff00965da290fd Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 15 Aug 2018 20:55:39 +0000 Subject: [PATCH 6/6] Generated from 377e5cc3f8f10f71d7816d78462fbb68685453bd Fixed types for latencies in networkwatcher.json --- .../lib/models/connectionStateSnapshot.js | 40 +++++++++++++++++++ .../networkManagement2/lib/models/index.d.ts | 10 +++++ 2 files changed, 50 insertions(+) diff --git a/lib/services/networkManagement2/lib/models/connectionStateSnapshot.js b/lib/services/networkManagement2/lib/models/connectionStateSnapshot.js index ccf3aeec06..134fcd5235 100644 --- a/lib/services/networkManagement2/lib/models/connectionStateSnapshot.js +++ b/lib/services/networkManagement2/lib/models/connectionStateSnapshot.js @@ -25,6 +25,11 @@ class ConnectionStateSnapshot { * @member {date} [endTime] The end time of the connection snapshot. * @member {string} [evaluationState] Connectivity analysis evaluation state. * Possible values include: 'NotStarted', 'InProgress', 'Completed' + * @member {number} [avgLatencyInMs] Average latency in ms. + * @member {number} [minLatencyInMs] Minimum latency in ms. + * @member {number} [maxLatencyInMs] Maximum latency in ms. + * @member {number} [probesSent] The number of sent probes. + * @member {number} [probesFailed] The number of failed probes. * @member {array} [hops] List of hops between the source and the * destination. */ @@ -73,6 +78,41 @@ class ConnectionStateSnapshot { name: 'String' } }, + avgLatencyInMs: { + required: false, + serializedName: 'avgLatencyInMs', + type: { + name: 'Number' + } + }, + minLatencyInMs: { + required: false, + serializedName: 'minLatencyInMs', + type: { + name: 'Number' + } + }, + maxLatencyInMs: { + required: false, + serializedName: 'maxLatencyInMs', + type: { + name: 'Number' + } + }, + probesSent: { + required: false, + serializedName: 'probesSent', + type: { + name: 'Number' + } + }, + probesFailed: { + required: false, + serializedName: 'probesFailed', + type: { + name: 'Number' + } + }, hops: { required: false, readOnly: true, diff --git a/lib/services/networkManagement2/lib/models/index.d.ts b/lib/services/networkManagement2/lib/models/index.d.ts index c488750c0a..1b4552f3d9 100644 --- a/lib/services/networkManagement2/lib/models/index.d.ts +++ b/lib/services/networkManagement2/lib/models/index.d.ts @@ -5366,6 +5366,11 @@ export interface ConnectionMonitorResult extends BaseResource { * @member {date} [endTime] The end time of the connection snapshot. * @member {string} [evaluationState] Connectivity analysis evaluation state. * Possible values include: 'NotStarted', 'InProgress', 'Completed' + * @member {number} [avgLatencyInMs] Average latency in ms. + * @member {number} [minLatencyInMs] Minimum latency in ms. + * @member {number} [maxLatencyInMs] Maximum latency in ms. + * @member {number} [probesSent] The number of sent probes. + * @member {number} [probesFailed] The number of failed probes. * @member {array} [hops] List of hops between the source and the destination. */ export interface ConnectionStateSnapshot { @@ -5373,6 +5378,11 @@ export interface ConnectionStateSnapshot { startTime?: Date; endTime?: Date; evaluationState?: string; + avgLatencyInMs?: number; + minLatencyInMs?: number; + maxLatencyInMs?: number; + probesSent?: number; + probesFailed?: number; readonly hops?: ConnectivityHop[]; }