From 3c3048b2c81ad420f19e928b741bd011efd41cd7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 00:21:07 +0000 Subject: [PATCH] Generated from 3c5a775d910055a60fea74423e7b4599f410abe1 Network 2018-02 for Go and Python --- .../networkManagement2/lib/LICENSE.txt | 21 + .../lib/lib/models/addressSpace.js | 61 + .../lib/lib/models/applicationGateway.js | 407 + ...icationGatewayAuthenticationCertificate.js | 99 + .../applicationGatewayAvailableSslOptions.js | 151 + ...onGatewayAvailableSslPredefinedPolicies.js | 67 + ...cationGatewayAvailableWafRuleSetsResult.js | 62 + .../applicationGatewayBackendAddress.js | 60 + .../applicationGatewayBackendAddressPool.js | 124 + .../models/applicationGatewayBackendHealth.js | 62 + ...icationGatewayBackendHealthHttpSettings.js | 116 + .../applicationGatewayBackendHealthPool.js | 84 + .../applicationGatewayBackendHealthServer.js | 292 + .../applicationGatewayBackendHttpSettings.js | 214 + .../applicationGatewayConnectionDraining.js | 67 + ...icationGatewayFirewallDisabledRuleGroup.js | 69 + .../models/applicationGatewayFirewallRule.js | 62 + .../applicationGatewayFirewallRuleGroup.js | 81 + .../applicationGatewayFirewallRuleSet.js | 136 + ...plicationGatewayFrontendIPConfiguration.js | 128 + .../models/applicationGatewayFrontendPort.js | 98 + .../models/applicationGatewayHttpListener.js | 150 + .../applicationGatewayIPConfiguration.js | 103 + .../models/applicationGatewayListResult.js | 67 + .../lib/models/applicationGatewayPathRule.js | 138 + .../lib/lib/models/applicationGatewayProbe.js | 180 + ...licationGatewayProbeHealthResponseMatch.js | 69 + ...applicationGatewayRedirectConfiguration.js | 177 + .../applicationGatewayRequestRoutingRule.js | 155 + .../lib/lib/models/applicationGatewaySku.js | 72 + .../applicationGatewaySslCertificate.js | 118 + .../lib/models/applicationGatewaySslPolicy.js | 105 + .../applicationGatewaySslPredefinedPolicy.js | 89 + .../models/applicationGatewayUrlPathMap.js | 141 + ...ewayWebApplicationFirewallConfiguration.js | 118 + .../lib/models/applicationSecurityGroup.js | 125 + .../applicationSecurityGroupListResult.js | 68 + .../lib/lib/models/authorizationListResult.js | 68 + .../lib/lib/models/availability.js | 68 + .../lib/lib/models/availableProvidersList.js | 62 + .../lib/models/availableProvidersListCity.js | 67 + .../models/availableProvidersListCountry.js | 85 + .../availableProvidersListParameters.js | 83 + .../lib/models/availableProvidersListState.js | 85 + .../lib/models/azureAsyncOperationResult.js | 77 + .../lib/lib/models/azureReachabilityReport.js | 84 + .../lib/models/azureReachabilityReportItem.js | 79 + .../azureReachabilityReportLatencyInfo.js | 65 + .../models/azureReachabilityReportLocation.js | 68 + .../azureReachabilityReportParameters.js | 105 + .../lib/lib/models/bGPCommunity.js | 106 + .../lib/lib/models/backendAddressPool.js | 130 + .../lib/lib/models/bgpPeerStatus.js | 119 + .../lib/lib/models/bgpPeerStatusListResult.js | 62 + .../lib/lib/models/bgpServiceCommunity.js | 116 + .../models/bgpServiceCommunityListResult.js | 67 + .../lib/lib/models/bgpSettings.js | 70 + .../lib/lib/models/connectionMonitor.js | 116 + .../models/connectionMonitorDestination.js | 70 + .../lib/models/connectionMonitorListResult.js | 59 + .../lib/models/connectionMonitorParameters.js | 93 + .../models/connectionMonitorQueryResult.js | 62 + .../lib/lib/models/connectionMonitorResult.js | 183 + .../lib/lib/models/connectionMonitorSource.js | 61 + .../lib/models/connectionResetSharedKey.js | 57 + .../lib/lib/models/connectionSharedKey.js | 52 + .../lib/lib/models/connectionStateSnapshot.js | 98 + .../lib/lib/models/connectivityDestination.js | 71 + .../lib/lib/models/connectivityHop.js | 116 + .../lib/lib/models/connectivityInformation.js | 119 + .../lib/lib/models/connectivityIssue.js | 99 + .../lib/lib/models/connectivityParameters.js | 74 + .../lib/lib/models/connectivitySource.js | 62 + .../lib/lib/models/ddosProtectionPlan.js | 143 + .../models/ddosProtectionPlanListResult.js | 68 + .../lib/lib/models/dhcpOptions.js | 61 + .../lib/lib/models/dimension.js | 68 + .../lib/models/dnsNameAvailabilityResult.js | 52 + .../models/effectiveNetworkSecurityGroup.js | 111 + ...ffectiveNetworkSecurityGroupAssociation.js | 67 + ...effectiveNetworkSecurityGroupListResult.js | 71 + .../models/effectiveNetworkSecurityRule.js | 225 + .../lib/lib/models/effectiveRoute.js | 116 + .../lib/models/effectiveRouteListResult.js | 71 + .../lib/lib/models/endpointServiceResult.js | 73 + .../lib/models/endpointServicesListResult.js | 67 + .../lib/lib/models/errorDetails.js | 67 + .../lib/lib/models/errorModel.js | 93 + .../lib/lib/models/expressRouteCircuit.js | 228 + .../lib/models/expressRouteCircuitArpTable.js | 76 + .../expressRouteCircuitAuthorization.js | 102 + .../models/expressRouteCircuitConnection.js | 135 + .../models/expressRouteCircuitListResult.js | 67 + .../lib/models/expressRouteCircuitPeering.js | 309 + .../expressRouteCircuitPeeringConfig.js | 113 + .../expressRouteCircuitPeeringListResult.js | 68 + .../models/expressRouteCircuitReference.js | 51 + .../models/expressRouteCircuitRoutesTable.js | 84 + .../expressRouteCircuitRoutesTableSummary.js | 87 + ...ssRouteCircuitServiceProviderProperties.js | 68 + .../lib/lib/models/expressRouteCircuitSku.js | 71 + .../lib/models/expressRouteCircuitStats.js | 76 + .../expressRouteCircuitsArpTableListResult.js | 70 + ...pressRouteCircuitsRoutesTableListResult.js | 70 + ...uteCircuitsRoutesTableSummaryListResult.js | 70 + .../lib/models/expressRouteCrossConnection.js | 207 + .../expressRouteCrossConnectionListResult.js | 68 + .../expressRouteCrossConnectionPeering.js | 266 + .../expressRouteCrossConnectionPeeringList.js | 69 + ...sRouteCrossConnectionRoutesTableSummary.js | 80 + ...ConnectionsRoutesTableSummaryListResult.js | 72 + .../lib/models/expressRouteServiceProvider.js | 132 + ...ssRouteServiceProviderBandwidthsOffered.js | 60 + .../expressRouteServiceProviderListResult.js | 67 + .../lib/lib/models/flowLogInformation.js | 85 + .../lib/lib/models/flowLogStatusParameters.js | 53 + .../lib/lib/models/frontendIPConfiguration.js | 374 + .../lib/lib/models/gatewayRoute.js | 107 + .../lib/lib/models/gatewayRouteListResult.js | 62 + .../lib/models/iPAddressAvailabilityResult.js | 68 + .../lib/lib/models/iPConfiguration.js | 207 + .../lib/lib/models/inboundNatPool.js | 155 + .../lib/lib/models/inboundNatRule.js | 389 + .../lib/models/inboundNatRuleListResult.js | 68 + .../lib/lib/models/index.d.ts | 6789 ++++ .../lib/lib/models/index.js | 250 + .../lib/lib/models/ipTag.js | 62 + .../lib/lib/models/ipsecPolicy.js | 124 + .../ipv6ExpressRouteCircuitPeeringConfig.js | 115 + .../lib/lib/models/loadBalancer.js | 260 + ...oadBalancerBackendAddressPoolListResult.js | 68 + ...lancerFrontendIPConfigurationListResult.js | 68 + .../lib/lib/models/loadBalancerListResult.js | 68 + ...loadBalancerLoadBalancingRuleListResult.js | 68 + .../lib/models/loadBalancerProbeListResult.js | 68 + .../lib/lib/models/loadBalancerSku.js | 53 + .../lib/lib/models/loadBalancingRule.js | 187 + .../lib/lib/models/localNetworkGateway.js | 156 + .../models/localNetworkGatewayListResult.js | 68 + .../lib/lib/models/logSpecification.js | 68 + .../lib/lib/models/metricSpecification.js | 178 + .../lib/lib/models/networkInterface.js | 233 + .../lib/models/networkInterfaceAssociation.js | 71 + .../lib/models/networkInterfaceDnsSettings.js | 109 + .../models/networkInterfaceIPConfiguration.js | 374 + ...tworkInterfaceIPConfigurationListResult.js | 68 + .../lib/models/networkInterfaceListResult.js | 68 + .../networkInterfaceLoadBalancerListResult.js | 68 + .../lib/lib/models/networkSecurityGroup.js | 188 + .../models/networkSecurityGroupListResult.js | 67 + .../lib/lib/models/networkWatcher.js | 112 + .../lib/models/networkWatcherListResult.js | 59 + .../lib/lib/models/nextHopParameters.js | 79 + .../lib/lib/models/nextHopResult.js | 73 + .../lib/lib/models/operation.js | 90 + .../lib/lib/models/operationDisplay.js | 77 + .../lib/lib/models/operationListResult.js | 69 + ...ionPropertiesFormatServiceSpecification.js | 78 + .../lib/lib/models/outboundNatRule.js | 120 + .../lib/lib/models/packetCapture.js | 120 + .../lib/lib/models/packetCaptureFilter.js | 101 + .../lib/lib/models/packetCaptureListResult.js | 59 + .../lib/lib/models/packetCaptureParameters.js | 120 + .../models/packetCaptureQueryStatusResult.js | 104 + .../lib/lib/models/packetCaptureResult.js | 158 + .../models/packetCaptureStorageLocation.js | 74 + .../lib/lib/models/patchRouteFilter.js | 144 + .../lib/lib/models/patchRouteFilterRule.js | 120 + .../lib/lib/models/probe.js | 155 + .../lib/lib/models/publicIPAddress.js | 305 + .../lib/models/publicIPAddressDnsSettings.js | 78 + .../lib/models/publicIPAddressListResult.js | 67 + .../lib/lib/models/publicIPAddressSku.js | 53 + .../models/queryTroubleshootingParameters.js | 53 + .../lib/lib/models/resource.js | 97 + .../lib/lib/models/resourceNavigationLink.js | 101 + .../lib/models/retentionPolicyParameters.js | 64 + .../lib/lib/models/route.js | 113 + .../lib/lib/models/routeFilter.js | 147 + .../lib/lib/models/routeFilterListResult.js | 67 + .../lib/lib/models/routeFilterRule.js | 127 + .../lib/models/routeFilterRuleListResult.js | 67 + .../lib/lib/models/routeListResult.js | 67 + .../lib/lib/models/routeTable.js | 153 + .../lib/lib/models/routeTableListResult.js | 67 + .../models/securityGroupNetworkInterface.js | 78 + .../lib/models/securityGroupViewParameters.js | 52 + .../lib/lib/models/securityGroupViewResult.js | 63 + .../lib/lib/models/securityRule.js | 269 + .../lib/models/securityRuleAssociations.js | 104 + .../lib/lib/models/securityRuleListResult.js | 68 + .../models/serviceEndpointPropertiesFormat.js | 76 + .../lib/lib/models/subResource.js | 56 + .../lib/lib/models/subnet.js | 186 + .../lib/lib/models/subnetAssociation.js | 71 + .../lib/lib/models/subnetListResult.js | 68 + .../lib/lib/models/tagsObject.js | 59 + .../lib/lib/models/topology.js | 91 + .../lib/lib/models/topologyAssociation.js | 72 + .../lib/lib/models/topologyParameters.js | 76 + .../lib/lib/models/topologyResource.js | 87 + .../lib/lib/models/troubleshootingDetails.js | 94 + .../lib/models/troubleshootingParameters.js | 70 + .../troubleshootingRecommendedActions.js | 78 + .../lib/lib/models/troubleshootingResult.js | 86 + .../lib/lib/models/tunnelConnectionHealth.js | 94 + .../lib/lib/models/usage.js | 92 + .../lib/lib/models/usageName.js | 61 + .../lib/lib/models/usagesListResult.js | 67 + .../models/verificationIPFlowParameters.js | 119 + .../lib/models/verificationIPFlowResult.js | 62 + .../lib/lib/models/virtualNetwork.js | 210 + ...irtualNetworkConnectionGatewayReference.js | 53 + .../lib/lib/models/virtualNetworkGateway.js | 251 + .../models/virtualNetworkGatewayConnection.js | 447 + ...rtualNetworkGatewayConnectionListEntity.js | 285 + ...rtualNetworkGatewayConnectionListResult.js | 68 + .../virtualNetworkGatewayIPConfiguration.js | 114 + ...tualNetworkGatewayListConnectionsResult.js | 68 + .../models/virtualNetworkGatewayListResult.js | 68 + .../lib/models/virtualNetworkGatewaySku.js | 72 + .../lib/models/virtualNetworkListResult.js | 67 + .../models/virtualNetworkListUsageResult.js | 68 + .../lib/lib/models/virtualNetworkPeering.js | 159 + .../models/virtualNetworkPeeringListResult.js | 68 + .../lib/lib/models/virtualNetworkUsage.js | 97 + .../lib/lib/models/virtualNetworkUsageName.js | 62 + .../lib/lib/models/vpnClientConfiguration.js | 143 + .../lib/models/vpnClientIPsecParameters.js | 122 + .../lib/lib/models/vpnClientParameters.js | 92 + .../lib/models/vpnClientRevokedCertificate.js | 93 + .../lib/models/vpnClientRootCertificate.js | 92 + .../lib/models/vpnDeviceScriptParameters.js | 69 + .../lib/lib/networkManagementClient.d.ts | 166 + .../lib/lib/networkManagementClient.js | 366 + .../lib/lib/operations/applicationGateways.js | 5326 +++ .../operations/applicationSecurityGroups.js | 1995 + .../operations/availableEndpointServices.js | 467 + .../lib/operations/bgpServiceCommunities.js | 457 + .../lib/lib/operations/connectionMonitors.js | 2760 ++ .../lib/lib/operations/ddosProtectionPlans.js | 1974 + .../lib/operations/defaultSecurityRules.js | 728 + .../expressRouteCircuitAuthorizations.js | 1676 + .../expressRouteCircuitConnections.js | 1348 + .../operations/expressRouteCircuitPeerings.js | 2330 ++ .../lib/operations/expressRouteCircuits.js | 4511 +++ .../expressRouteCrossConnectionPeerings.js | 2150 ++ .../expressRouteCrossConnections.js | 3466 ++ .../expressRouteServiceProviders.js | 457 + .../lib/lib/operations/inboundNatRules.js | 1815 + .../lib/lib/operations/index.d.ts | 30651 ++++++++++++++++ .../lib/lib/operations/index.js | 57 + .../loadBalancerBackendAddressPools.js | 719 + .../loadBalancerFrontendIPConfigurations.js | 728 + .../loadBalancerLoadBalancingRules.js | 719 + .../loadBalancerNetworkInterfaces.js | 477 + .../lib/lib/operations/loadBalancerProbes.js | 719 + .../lib/lib/operations/loadBalancers.js | 2701 ++ .../lib/operations/localNetworkGateways.js | 2191 ++ .../networkInterfaceIPConfigurations.js | 721 + .../networkInterfaceLoadBalancers.js | 477 + .../lib/lib/operations/networkInterfaces.js | 5674 +++ .../lib/operations/networkSecurityGroups.js | 2548 ++ .../lib/lib/operations/networkWatchers.js | 7202 ++++ .../lib/lib/operations/operations.js | 449 + .../lib/lib/operations/packetCaptures.js | 2323 ++ .../lib/lib/operations/publicIPAddresses.js | 3981 ++ .../lib/lib/operations/routeFilterRules.js | 2162 ++ .../lib/lib/operations/routeFilters.js | 2510 ++ .../lib/lib/operations/routeTables.js | 2495 ++ .../lib/lib/operations/routes.js | 1708 + .../lib/lib/operations/securityRules.js | 2006 + .../lib/lib/operations/subnets.js | 1991 + .../lib/lib/operations/usages.js | 469 + .../virtualNetworkGatewayConnections.js | 4221 +++ .../lib/operations/virtualNetworkGateways.js | 7822 ++++ .../lib/operations/virtualNetworkPeerings.js | 1883 + .../lib/lib/operations/virtualNetworks.js | 3360 ++ .../networkManagement2/lib/package.json | 22 + 279 files changed, 156560 insertions(+) create mode 100644 lib/services/networkManagement2/lib/LICENSE.txt create mode 100644 lib/services/networkManagement2/lib/lib/models/addressSpace.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGateway.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayAuthenticationCertificate.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslOptions.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslPredefinedPolicies.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableWafRuleSetsResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddress.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddressPool.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealth.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthHttpSettings.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthPool.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthServer.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHttpSettings.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayConnectionDraining.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallDisabledRuleGroup.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleGroup.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleSet.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendIPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendPort.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayHttpListener.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayIPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayPathRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayProbe.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayProbeHealthResponseMatch.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayRedirectConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayRequestRoutingRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewaySku.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewaySslCertificate.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPolicy.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPredefinedPolicy.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayUrlPathMap.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationGatewayWebApplicationFirewallConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationSecurityGroup.js create mode 100644 lib/services/networkManagement2/lib/lib/models/applicationSecurityGroupListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/authorizationListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availability.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availableProvidersList.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availableProvidersListCity.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availableProvidersListCountry.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availableProvidersListParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/availableProvidersListState.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureReachabilityReport.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureReachabilityReportItem.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLatencyInfo.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLocation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/azureReachabilityReportParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bGPCommunity.js create mode 100644 lib/services/networkManagement2/lib/lib/models/backendAddressPool.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bgpPeerStatus.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bgpPeerStatusListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bgpServiceCommunity.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bgpServiceCommunityListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/bgpSettings.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitor.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorDestination.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorQueryResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionMonitorSource.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionResetSharedKey.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionSharedKey.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectionStateSnapshot.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivityDestination.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivityHop.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivityInformation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivityIssue.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivityParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/connectivitySource.js create mode 100644 lib/services/networkManagement2/lib/lib/models/ddosProtectionPlan.js create mode 100644 lib/services/networkManagement2/lib/lib/models/ddosProtectionPlanListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/dhcpOptions.js create mode 100644 lib/services/networkManagement2/lib/lib/models/dimension.js create mode 100644 lib/services/networkManagement2/lib/lib/models/dnsNameAvailabilityResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroup.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupAssociation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveRoute.js create mode 100644 lib/services/networkManagement2/lib/lib/models/effectiveRouteListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/endpointServiceResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/endpointServicesListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/errorDetails.js create mode 100644 lib/services/networkManagement2/lib/lib/models/errorModel.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuit.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitArpTable.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitAuthorization.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitConnection.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeering.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringConfig.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitReference.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTable.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTableSummary.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitServiceProviderProperties.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitSku.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitStats.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsArpTableListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableSummaryListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnection.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeering.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeeringList.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionRoutesTableSummary.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionsRoutesTableSummaryListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteServiceProvider.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderBandwidthsOffered.js create mode 100644 lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/flowLogInformation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/flowLogStatusParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/frontendIPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/gatewayRoute.js create mode 100644 lib/services/networkManagement2/lib/lib/models/gatewayRouteListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/iPAddressAvailabilityResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/iPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/inboundNatPool.js create mode 100644 lib/services/networkManagement2/lib/lib/models/inboundNatRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/inboundNatRuleListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/index.d.ts create mode 100644 lib/services/networkManagement2/lib/lib/models/index.js create mode 100644 lib/services/networkManagement2/lib/lib/models/ipTag.js create mode 100644 lib/services/networkManagement2/lib/lib/models/ipsecPolicy.js create mode 100644 lib/services/networkManagement2/lib/lib/models/ipv6ExpressRouteCircuitPeeringConfig.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancer.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerBackendAddressPoolListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerFrontendIPConfigurationListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerLoadBalancingRuleListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerProbeListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancerSku.js create mode 100644 lib/services/networkManagement2/lib/lib/models/loadBalancingRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/localNetworkGateway.js create mode 100644 lib/services/networkManagement2/lib/lib/models/localNetworkGatewayListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/logSpecification.js create mode 100644 lib/services/networkManagement2/lib/lib/models/metricSpecification.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterface.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceAssociation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceDnsSettings.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfigurationListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkInterfaceLoadBalancerListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkSecurityGroup.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkSecurityGroupListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkWatcher.js create mode 100644 lib/services/networkManagement2/lib/lib/models/networkWatcherListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/nextHopParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/nextHopResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/operation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/operationDisplay.js create mode 100644 lib/services/networkManagement2/lib/lib/models/operationListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/operationPropertiesFormatServiceSpecification.js create mode 100644 lib/services/networkManagement2/lib/lib/models/outboundNatRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCapture.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureFilter.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureQueryStatusResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/packetCaptureStorageLocation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/patchRouteFilter.js create mode 100644 lib/services/networkManagement2/lib/lib/models/patchRouteFilterRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/probe.js create mode 100644 lib/services/networkManagement2/lib/lib/models/publicIPAddress.js create mode 100644 lib/services/networkManagement2/lib/lib/models/publicIPAddressDnsSettings.js create mode 100644 lib/services/networkManagement2/lib/lib/models/publicIPAddressListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/publicIPAddressSku.js create mode 100644 lib/services/networkManagement2/lib/lib/models/queryTroubleshootingParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/resource.js create mode 100644 lib/services/networkManagement2/lib/lib/models/resourceNavigationLink.js create mode 100644 lib/services/networkManagement2/lib/lib/models/retentionPolicyParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/route.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeFilter.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeFilterListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeFilterRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeFilterRuleListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeTable.js create mode 100644 lib/services/networkManagement2/lib/lib/models/routeTableListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityGroupNetworkInterface.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityGroupViewParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityGroupViewResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityRule.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityRuleAssociations.js create mode 100644 lib/services/networkManagement2/lib/lib/models/securityRuleListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/serviceEndpointPropertiesFormat.js create mode 100644 lib/services/networkManagement2/lib/lib/models/subResource.js create mode 100644 lib/services/networkManagement2/lib/lib/models/subnet.js create mode 100644 lib/services/networkManagement2/lib/lib/models/subnetAssociation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/subnetListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/tagsObject.js create mode 100644 lib/services/networkManagement2/lib/lib/models/topology.js create mode 100644 lib/services/networkManagement2/lib/lib/models/topologyAssociation.js create mode 100644 lib/services/networkManagement2/lib/lib/models/topologyParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/topologyResource.js create mode 100644 lib/services/networkManagement2/lib/lib/models/troubleshootingDetails.js create mode 100644 lib/services/networkManagement2/lib/lib/models/troubleshootingParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/troubleshootingRecommendedActions.js create mode 100644 lib/services/networkManagement2/lib/lib/models/troubleshootingResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/tunnelConnectionHealth.js create mode 100644 lib/services/networkManagement2/lib/lib/models/usage.js create mode 100644 lib/services/networkManagement2/lib/lib/models/usageName.js create mode 100644 lib/services/networkManagement2/lib/lib/models/usagesListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/verificationIPFlowParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/verificationIPFlowResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetwork.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkConnectionGatewayReference.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGateway.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnection.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListEntity.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayIPConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListConnectionsResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewaySku.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkListUsageResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkPeering.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkPeeringListResult.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkUsage.js create mode 100644 lib/services/networkManagement2/lib/lib/models/virtualNetworkUsageName.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnClientConfiguration.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnClientIPsecParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnClientParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnClientRevokedCertificate.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnClientRootCertificate.js create mode 100644 lib/services/networkManagement2/lib/lib/models/vpnDeviceScriptParameters.js create mode 100644 lib/services/networkManagement2/lib/lib/networkManagementClient.d.ts create mode 100644 lib/services/networkManagement2/lib/lib/networkManagementClient.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/applicationGateways.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/applicationSecurityGroups.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/availableEndpointServices.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/bgpServiceCommunities.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/connectionMonitors.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/ddosProtectionPlans.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/defaultSecurityRules.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitAuthorizations.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitConnections.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitPeerings.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCircuits.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnectionPeerings.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnections.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/expressRouteServiceProviders.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/inboundNatRules.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/index.d.ts create mode 100644 lib/services/networkManagement2/lib/lib/operations/index.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancerBackendAddressPools.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancerFrontendIPConfigurations.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancerLoadBalancingRules.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancerNetworkInterfaces.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancerProbes.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/loadBalancers.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/localNetworkGateways.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/networkInterfaceIPConfigurations.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/networkInterfaceLoadBalancers.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/networkInterfaces.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/networkSecurityGroups.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/networkWatchers.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/operations.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/packetCaptures.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/publicIPAddresses.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/routeFilterRules.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/routeFilters.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/routeTables.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/routes.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/securityRules.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/subnets.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/usages.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/virtualNetworkGatewayConnections.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/virtualNetworkGateways.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/virtualNetworkPeerings.js create mode 100644 lib/services/networkManagement2/lib/lib/operations/virtualNetworks.js create mode 100644 lib/services/networkManagement2/lib/package.json diff --git a/lib/services/networkManagement2/lib/LICENSE.txt b/lib/services/networkManagement2/lib/LICENSE.txt new file mode 100644 index 0000000000..5431ba98b9 --- /dev/null +++ b/lib/services/networkManagement2/lib/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2018 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lib/services/networkManagement2/lib/lib/models/addressSpace.js b/lib/services/networkManagement2/lib/lib/models/addressSpace.js new file mode 100644 index 0000000000..d52191738d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/addressSpace.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'; + +/** + * AddressSpace contains an array of IP address ranges that can be used by + * subnets of the virtual network. + * + */ +class AddressSpace { + /** + * Create a AddressSpace. + * @member {array} [addressPrefixes] A list of address blocks reserved for + * this virtual network in CIDR notation. + */ + constructor() { + } + + /** + * Defines the metadata of AddressSpace + * + * @returns {object} metadata of AddressSpace + * + */ + mapper() { + return { + required: false, + serializedName: 'AddressSpace', + type: { + name: 'Composite', + className: 'AddressSpace', + modelProperties: { + addressPrefixes: { + required: false, + serializedName: 'addressPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = AddressSpace; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGateway.js b/lib/services/networkManagement2/lib/lib/models/applicationGateway.js new file mode 100644 index 0000000000..47ddea3f90 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGateway.js @@ -0,0 +1,407 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Application gateway resource + * + * @extends models['Resource'] + */ +class ApplicationGateway extends models['Resource'] { + /** + * Create a ApplicationGateway. + * @member {object} [sku] SKU of the application gateway resource. + * @member {string} [sku.name] Name of an application gateway SKU. Possible + * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', + * 'WAF_Medium', 'WAF_Large' + * @member {string} [sku.tier] Tier of an application gateway. Possible + * values include: 'Standard', 'WAF' + * @member {number} [sku.capacity] Capacity (instance count) of an + * application gateway. + * @member {object} [sslPolicy] SSL policy of the application gateway + * resource. + * @member {array} [sslPolicy.disabledSslProtocols] Ssl protocols to be + * disabled on application gateway. + * @member {string} [sslPolicy.policyType] Type of Ssl Policy. Possible + * values include: 'Predefined', 'Custom' + * @member {string} [sslPolicy.policyName] Name of Ssl predefined policy. + * Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * @member {array} [sslPolicy.cipherSuites] Ssl cipher suites to be enabled + * in the specified order to application gateway. + * @member {string} [sslPolicy.minProtocolVersion] Minimum version of Ssl + * protocol to be supported on application gateway. Possible values include: + * 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * @member {string} [operationalState] Operational state of the application + * gateway resource. Possible values include: 'Stopped', 'Starting', + * 'Running', 'Stopping' + * @member {array} [gatewayIPConfigurations] Subnets of application the + * gateway resource. + * @member {array} [authenticationCertificates] Authentication certificates + * of the application gateway resource. + * @member {array} [sslCertificates] SSL certificates of the application + * gateway resource. + * @member {array} [frontendIPConfigurations] Frontend IP addresses of the + * application gateway resource. + * @member {array} [frontendPorts] Frontend ports of the application gateway + * resource. + * @member {array} [probes] Probes of the application gateway resource. + * @member {array} [backendAddressPools] Backend address pool of the + * application gateway resource. + * @member {array} [backendHttpSettingsCollection] Backend http settings of + * the application gateway resource. + * @member {array} [httpListeners] Http listeners of the application gateway + * resource. + * @member {array} [urlPathMaps] URL path map of the application gateway + * resource. + * @member {array} [requestRoutingRules] Request routing rules of the + * application gateway resource. + * @member {array} [redirectConfigurations] Redirect configurations of the + * application gateway resource. + * @member {object} [webApplicationFirewallConfiguration] Web application + * firewall configuration. + * @member {boolean} [webApplicationFirewallConfiguration.enabled] Whether + * the web application firewall is enabled or not. + * @member {string} [webApplicationFirewallConfiguration.firewallMode] Web + * application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * @member {string} [webApplicationFirewallConfiguration.ruleSetType] The + * type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * @member {string} [webApplicationFirewallConfiguration.ruleSetVersion] The + * version of the rule set type. + * @member {array} [webApplicationFirewallConfiguration.disabledRuleGroups] + * The disabled rule groups. + * @member {boolean} [webApplicationFirewallConfiguration.requestBodyCheck] + * Whether allow WAF to check request Body. + * @member {number} [webApplicationFirewallConfiguration.maxRequestBodySize] + * Maxium request body size for WAF. + * @member {boolean} [enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * @member {string} [resourceGuid] Resource GUID property of the application + * gateway resource. + * @member {string} [provisioningState] Provisioning state of the application + * gateway resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGateway + * + * @returns {object} metadata of ApplicationGateway + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGateway', + type: { + name: 'Composite', + className: 'ApplicationGateway', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'ApplicationGatewaySku' + } + }, + sslPolicy: { + required: false, + serializedName: 'properties.sslPolicy', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslPolicy' + } + }, + operationalState: { + required: false, + readOnly: true, + serializedName: 'properties.operationalState', + type: { + name: 'String' + } + }, + gatewayIPConfigurations: { + required: false, + serializedName: 'properties.gatewayIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayIPConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayIPConfiguration' + } + } + } + }, + authenticationCertificates: { + required: false, + serializedName: 'properties.authenticationCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayAuthenticationCertificateElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayAuthenticationCertificate' + } + } + } + }, + sslCertificates: { + required: false, + serializedName: 'properties.sslCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewaySslCertificateElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslCertificate' + } + } + } + }, + frontendIPConfigurations: { + required: false, + serializedName: 'properties.frontendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFrontendIPConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFrontendIPConfiguration' + } + } + } + }, + frontendPorts: { + required: false, + serializedName: 'properties.frontendPorts', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFrontendPortElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFrontendPort' + } + } + } + }, + probes: { + required: false, + serializedName: 'properties.probes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayProbeElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayProbe' + } + } + } + }, + backendAddressPools: { + required: false, + serializedName: 'properties.backendAddressPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendAddressPoolElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddressPool' + } + } + } + }, + backendHttpSettingsCollection: { + required: false, + serializedName: 'properties.backendHttpSettingsCollection', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendHttpSettingsElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHttpSettings' + } + } + } + }, + httpListeners: { + required: false, + serializedName: 'properties.httpListeners', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayHttpListenerElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayHttpListener' + } + } + } + }, + urlPathMaps: { + required: false, + serializedName: 'properties.urlPathMaps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayUrlPathMapElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayUrlPathMap' + } + } + } + }, + requestRoutingRules: { + required: false, + serializedName: 'properties.requestRoutingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayRequestRoutingRuleElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayRequestRoutingRule' + } + } + } + }, + redirectConfigurations: { + required: false, + serializedName: 'properties.redirectConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayRedirectConfigurationElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayRedirectConfiguration' + } + } + } + }, + webApplicationFirewallConfiguration: { + required: false, + serializedName: 'properties.webApplicationFirewallConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayWebApplicationFirewallConfiguration' + } + }, + enableHttp2: { + required: false, + serializedName: 'properties.enableHttp2', + type: { + name: 'Boolean' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGateway; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayAuthenticationCertificate.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAuthenticationCertificate.js new file mode 100644 index 0000000000..14cb3e2832 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAuthenticationCertificate.js @@ -0,0 +1,99 @@ +/* + * 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'); + +/** + * Authentication certificates of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayAuthenticationCertificate extends models['SubResource'] { + /** + * Create a ApplicationGatewayAuthenticationCertificate. + * @member {string} [data] Certificate public data. + * @member {string} [provisioningState] Provisioning state of the + * authentication certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayAuthenticationCertificate + * + * @returns {object} metadata of ApplicationGatewayAuthenticationCertificate + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAuthenticationCertificate', + type: { + name: 'Composite', + className: 'ApplicationGatewayAuthenticationCertificate', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + data: { + required: false, + serializedName: 'properties.data', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAuthenticationCertificate; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslOptions.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslOptions.js new file mode 100644 index 0000000000..0d2c74fe8d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslOptions.js @@ -0,0 +1,151 @@ +/* + * 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'); + +/** + * Response for ApplicationGatewayAvailableSslOptions API service call. + * + * @extends models['Resource'] + */ +class ApplicationGatewayAvailableSslOptions extends models['Resource'] { + /** + * Create a ApplicationGatewayAvailableSslOptions. + * @member {array} [predefinedPolicies] List of available Ssl predefined + * policy. + * @member {string} [defaultPolicy] Name of the Ssl predefined policy applied + * by default to application gateway. Possible values include: + * 'AppGwSslPolicy20150501', 'AppGwSslPolicy20170401', + * 'AppGwSslPolicy20170401S' + * @member {array} [availableCipherSuites] List of available Ssl cipher + * suites. + * @member {array} [availableProtocols] List of available Ssl protocols. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayAvailableSslOptions + * + * @returns {object} metadata of ApplicationGatewayAvailableSslOptions + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAvailableSslOptions', + type: { + name: 'Composite', + className: 'ApplicationGatewayAvailableSslOptions', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + predefinedPolicies: { + required: false, + serializedName: 'properties.predefinedPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + defaultPolicy: { + required: false, + serializedName: 'properties.defaultPolicy', + type: { + name: 'String' + } + }, + availableCipherSuites: { + required: false, + serializedName: 'properties.availableCipherSuites', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + availableProtocols: { + required: false, + serializedName: 'properties.availableProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAvailableSslOptions; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslPredefinedPolicies.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslPredefinedPolicies.js new file mode 100644 index 0000000000..5b1ac67da0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableSslPredefinedPolicies.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'; + +/** + * Response for ApplicationGatewayAvailableSslOptions API service call. + */ +class ApplicationGatewayAvailableSslPredefinedPolicies extends Array { + /** + * Create a ApplicationGatewayAvailableSslPredefinedPolicies. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayAvailableSslPredefinedPolicies + * + * @returns {object} metadata of ApplicationGatewayAvailableSslPredefinedPolicies + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAvailableSslPredefinedPolicies', + type: { + name: 'Composite', + className: 'ApplicationGatewayAvailableSslPredefinedPolicies', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewaySslPredefinedPolicyElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslPredefinedPolicy' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAvailableSslPredefinedPolicies; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableWafRuleSetsResult.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableWafRuleSetsResult.js new file mode 100644 index 0000000000..f9d3324627 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayAvailableWafRuleSetsResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Response for ApplicationGatewayAvailableWafRuleSets API service call. + * + */ +class ApplicationGatewayAvailableWafRuleSetsResult { + /** + * Create a ApplicationGatewayAvailableWafRuleSetsResult. + * @member {array} [value] The list of application gateway rule sets. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayAvailableWafRuleSetsResult + * + * @returns {object} metadata of ApplicationGatewayAvailableWafRuleSetsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayAvailableWafRuleSetsResult', + type: { + name: 'Composite', + className: 'ApplicationGatewayAvailableWafRuleSetsResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFirewallRuleSetElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRuleSet' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayAvailableWafRuleSetsResult; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddress.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddress.js new file mode 100644 index 0000000000..9efa6a4200 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddress.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * Backend address of an application gateway. + * + */ +class ApplicationGatewayBackendAddress { + /** + * Create a ApplicationGatewayBackendAddress. + * @member {string} [fqdn] Fully qualified domain name (FQDN). + * @member {string} [ipAddress] IP address + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayBackendAddress + * + * @returns {object} metadata of ApplicationGatewayBackendAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendAddress', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddress', + modelProperties: { + fqdn: { + required: false, + serializedName: 'fqdn', + type: { + name: 'String' + } + }, + ipAddress: { + required: false, + serializedName: 'ipAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendAddress; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddressPool.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddressPool.js new file mode 100644 index 0000000000..54daf5779f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendAddressPool.js @@ -0,0 +1,124 @@ +/* + * 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'); + +/** + * Backend Address Pool of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayBackendAddressPool extends models['SubResource'] { + /** + * Create a ApplicationGatewayBackendAddressPool. + * @member {array} [backendIPConfigurations] Collection of references to IPs + * defined in network interfaces. + * @member {array} [backendAddresses] Backend addresses + * @member {string} [provisioningState] Provisioning state of the backend + * address pool resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Resource that is unique within a resource group. + * This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayBackendAddressPool + * + * @returns {object} metadata of ApplicationGatewayBackendAddressPool + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendAddressPool', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddressPool', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + backendIPConfigurations: { + required: false, + serializedName: 'properties.backendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceIPConfigurationElementType', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + } + } + }, + backendAddresses: { + required: false, + serializedName: 'properties.backendAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendAddressElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddress' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendAddressPool; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealth.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealth.js new file mode 100644 index 0000000000..cb06b4e6e1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealth.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * List of ApplicationGatewayBackendHealthPool resources. + * + */ +class ApplicationGatewayBackendHealth { + /** + * Create a ApplicationGatewayBackendHealth. + * @member {array} [backendAddressPools] + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayBackendHealth + * + * @returns {object} metadata of ApplicationGatewayBackendHealth + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendHealth', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealth', + modelProperties: { + backendAddressPools: { + required: false, + serializedName: 'backendAddressPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendHealthPoolElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthPool' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendHealth; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthHttpSettings.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthHttpSettings.js new file mode 100644 index 0000000000..082f243482 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthHttpSettings.js @@ -0,0 +1,116 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Application gateway BackendHealthHttp settings. + * + */ +class ApplicationGatewayBackendHealthHttpSettings { + /** + * Create a ApplicationGatewayBackendHealthHttpSettings. + * @member {object} [backendHttpSettings] Reference of an + * ApplicationGatewayBackendHttpSettings resource. + * @member {number} [backendHttpSettings.port] Port + * @member {string} [backendHttpSettings.protocol] Protocol. Possible values + * include: 'Http', 'Https' + * @member {string} [backendHttpSettings.cookieBasedAffinity] Cookie based + * affinity. Possible values include: 'Enabled', 'Disabled' + * @member {number} [backendHttpSettings.requestTimeout] Request timeout in + * seconds. Application Gateway will fail the request if response is not + * received within RequestTimeout. Acceptable values are from 1 second to + * 86400 seconds. + * @member {object} [backendHttpSettings.probe] Probe resource of an + * application gateway. + * @member {string} [backendHttpSettings.probe.id] Resource ID. + * @member {array} [backendHttpSettings.authenticationCertificates] Array of + * references to application gateway authentication certificates. + * @member {object} [backendHttpSettings.connectionDraining] Connection + * draining of the backend http settings resource. + * @member {boolean} [backendHttpSettings.connectionDraining.enabled] Whether + * connection draining is enabled or not. + * @member {number} + * [backendHttpSettings.connectionDraining.drainTimeoutInSec] The number of + * seconds connection draining is active. Acceptable values are from 1 second + * to 3600 seconds. + * @member {string} [backendHttpSettings.hostName] Host header to be sent to + * the backend servers. + * @member {boolean} [backendHttpSettings.pickHostNameFromBackendAddress] + * Whether to pick host header should be picked from the host name of the + * backend server. Default value is false. + * @member {string} [backendHttpSettings.affinityCookieName] Cookie name to + * use for the affinity cookie. + * @member {boolean} [backendHttpSettings.probeEnabled] Whether the probe is + * enabled. Default value is false. + * @member {string} [backendHttpSettings.path] Path which should be used as a + * prefix for all HTTP requests. Null means no path will be prefixed. Default + * value is null. + * @member {string} [backendHttpSettings.provisioningState] Provisioning + * state of the backend http settings resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendHttpSettings.name] Name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [backendHttpSettings.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [backendHttpSettings.type] Type of the resource. + * @member {array} [servers] List of ApplicationGatewayBackendHealthServer + * resources. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayBackendHealthHttpSettings + * + * @returns {object} metadata of ApplicationGatewayBackendHealthHttpSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendHealthHttpSettings', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthHttpSettings', + modelProperties: { + backendHttpSettings: { + required: false, + serializedName: 'backendHttpSettings', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHttpSettings' + } + }, + servers: { + required: false, + serializedName: 'servers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendHealthServerElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthServer' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendHealthHttpSettings; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthPool.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthPool.js new file mode 100644 index 0000000000..15cdacf101 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthPool.js @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Application gateway BackendHealth pool. + * + */ +class ApplicationGatewayBackendHealthPool { + /** + * Create a ApplicationGatewayBackendHealthPool. + * @member {object} [backendAddressPool] Reference of an + * ApplicationGatewayBackendAddressPool resource. + * @member {array} [backendAddressPool.backendIPConfigurations] Collection of + * references to IPs defined in network interfaces. + * @member {array} [backendAddressPool.backendAddresses] Backend addresses + * @member {string} [backendAddressPool.provisioningState] Provisioning state + * of the backend address pool resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [backendAddressPool.name] Resource that is unique within + * a resource group. This name can be used to access the resource. + * @member {string} [backendAddressPool.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [backendAddressPool.type] Type of the resource. + * @member {array} [backendHttpSettingsCollection] List of + * ApplicationGatewayBackendHealthHttpSettings resources. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayBackendHealthPool + * + * @returns {object} metadata of ApplicationGatewayBackendHealthPool + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendHealthPool', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthPool', + modelProperties: { + backendAddressPool: { + required: false, + serializedName: 'backendAddressPool', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddressPool' + } + }, + backendHttpSettingsCollection: { + required: false, + serializedName: 'backendHttpSettingsCollection', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendHealthHttpSettingsElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthHttpSettings' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendHealthPool; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthServer.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthServer.js new file mode 100644 index 0000000000..1c0b56e51c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHealthServer.js @@ -0,0 +1,292 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Application gateway backendhealth http settings. + * + */ +class ApplicationGatewayBackendHealthServer { + /** + * Create a ApplicationGatewayBackendHealthServer. + * @member {string} [address] IP address or FQDN of backend server. + * @member {object} [ipConfiguration] Reference of IP configuration of + * backend server. + * @member {array} [ipConfiguration.applicationGatewayBackendAddressPools] + * The reference of ApplicationGatewayBackendAddressPool resource. + * @member {array} [ipConfiguration.loadBalancerBackendAddressPools] The + * reference of LoadBalancerBackendAddressPool resource. + * @member {array} [ipConfiguration.loadBalancerInboundNatRules] A list of + * references of LoadBalancerInboundNatRules. + * @member {string} [ipConfiguration.privateIPAddress] Private IP address of + * the IP configuration. + * @member {string} [ipConfiguration.privateIPAllocationMethod] Defines how a + * private IP address is assigned. Possible values are: 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {string} [ipConfiguration.privateIPAddressVersion] Available from + * Api-Version 2016-03-30 onwards, it represents whether the specific + * ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + * values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + * @member {object} [ipConfiguration.subnet] Subnet bound to the IP + * configuration. + * @member {string} [ipConfiguration.subnet.addressPrefix] The address prefix + * for the subnet. + * @member {object} [ipConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.subnet.routeTable] The reference of the + * RouteTable resource. + * @member {array} [ipConfiguration.subnet.routeTable.routes] Collection of + * routes contained within a route table. + * @member {array} [ipConfiguration.subnet.routeTable.subnets] A collection + * of references to subnets. + * @member {boolean} + * [ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} [ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.routeTable.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.subnet.serviceEndpoints] An array of + * service endpoints. + * @member {array} [ipConfiguration.subnet.ipConfigurations] Gets an array of + * references to the network interface IP configurations using subnet. + * @member {array} [ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [ipConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [ipConfiguration.subnet.name] The name of the resource + * that is unique within a resource group. This name can be used to access + * the resource. + * @member {string} [ipConfiguration.subnet.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {boolean} [ipConfiguration.primary] Gets whether this is a primary + * customer address on the network interface. + * @member {object} [ipConfiguration.publicIPAddress] Public IP address bound + * to the IP configuration. + * @member {object} [ipConfiguration.publicIPAddress.sku] The public IP + * address SKU. + * @member {string} [ipConfiguration.publicIPAddress.sku.name] Name of a + * public IP address SKU. Possible values include: 'Basic', 'Standard' + * @member {string} + * [ipConfiguration.publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [ipConfiguration.publicIPAddress.publicIPAddressVersion] + * The public IP address version. Possible values are: 'IPv4' and 'IPv6'. + * Possible values include: 'IPv4', 'IPv6' + * @member {object} [ipConfiguration.publicIPAddress.ipConfiguration] The IP + * configuration associated with the public IP address. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} [ipConfiguration.publicIPAddress.ipConfiguration.subnet] + * The reference of the subnet resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.addressPrefix] The + * address prefix for the subnet. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] + * The reference of the NetworkSecurityGroup resource. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] + * A collection of references to subnets. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] + * A unique read-only string that changes whenever the resource is updated. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] + * The provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.serviceEndpoints] + * An array of service endpoints. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations + * using subnet. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] + * Gets an array of references to the external resources using subnet. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.provisioningState] Gets + * the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.publicIPAddress.ipConfiguration.name] + * The name of the resource that is unique within a resource group. This name + * can be used to access the resource. + * @member {string} [ipConfiguration.publicIPAddress.ipConfiguration.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.publicIPAddress.dnsSettings] The FQDN of + * the DNS record associated with the public IP address. + * @member {string} + * [ipConfiguration.publicIPAddress.dnsSettings.domainNameLabel] Gets or sets + * the Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [ipConfiguration.publicIPAddress.dnsSettings.fqdn] Gets + * the FQDN, Fully qualified domain name of the A DNS record associated with + * the public IP. This is the concatenation of the domainNameLabel and the + * regionalized DNS zone. + * @member {string} [ipConfiguration.publicIPAddress.dnsSettings.reverseFqdn] + * Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name + * that resolves to this public IP address. If the reverseFqdn is specified, + * then a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [ipConfiguration.publicIPAddress.ipTags] The list of tags + * associated with the public IP address. + * @member {string} [ipConfiguration.publicIPAddress.ipAddress] The IP + * address associated with the public IP address resource. + * @member {number} [ipConfiguration.publicIPAddress.idleTimeoutInMinutes] + * The idle timeout of the public IP address. + * @member {string} [ipConfiguration.publicIPAddress.resourceGuid] The + * resource GUID property of the public IP resource. + * @member {string} [ipConfiguration.publicIPAddress.provisioningState] The + * provisioning state of the PublicIP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.publicIPAddress.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.publicIPAddress.zones] A list of + * availability zones denoting the IP allocated for the resource needs to + * come from. + * @member {array} [ipConfiguration.applicationSecurityGroups] Application + * security groups in which the IP configuration is included. + * @member {string} [ipConfiguration.provisioningState] The provisioning + * state of the network interface IP configuration. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [health] Health of backend server. Possible values + * include: 'Unknown', 'Up', 'Down', 'Partial', 'Draining' + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayBackendHealthServer + * + * @returns {object} metadata of ApplicationGatewayBackendHealthServer + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendHealthServer', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHealthServer', + modelProperties: { + address: { + required: false, + serializedName: 'address', + type: { + name: 'String' + } + }, + ipConfiguration: { + required: false, + serializedName: 'ipConfiguration', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + }, + health: { + required: false, + serializedName: 'health', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendHealthServer; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHttpSettings.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHttpSettings.js new file mode 100644 index 0000000000..5d294aaa9c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayBackendHttpSettings.js @@ -0,0 +1,214 @@ +/* + * 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'); + +/** + * Backend address pool settings of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayBackendHttpSettings extends models['SubResource'] { + /** + * Create a ApplicationGatewayBackendHttpSettings. + * @member {number} [port] Port + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [cookieBasedAffinity] Cookie based affinity. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [requestTimeout] Request timeout in seconds. Application + * Gateway will fail the request if response is not received within + * RequestTimeout. Acceptable values are from 1 second to 86400 seconds. + * @member {object} [probe] Probe resource of an application gateway. + * @member {string} [probe.id] Resource ID. + * @member {array} [authenticationCertificates] Array of references to + * application gateway authentication certificates. + * @member {object} [connectionDraining] Connection draining of the backend + * http settings resource. + * @member {boolean} [connectionDraining.enabled] Whether connection draining + * is enabled or not. + * @member {number} [connectionDraining.drainTimeoutInSec] The number of + * seconds connection draining is active. Acceptable values are from 1 second + * to 3600 seconds. + * @member {string} [hostName] Host header to be sent to the backend servers. + * @member {boolean} [pickHostNameFromBackendAddress] Whether to pick host + * header should be picked from the host name of the backend server. Default + * value is false. + * @member {string} [affinityCookieName] Cookie name to use for the affinity + * cookie. + * @member {boolean} [probeEnabled] Whether the probe is enabled. Default + * value is false. + * @member {string} [path] Path which should be used as a prefix for all HTTP + * requests. Null means no path will be prefixed. Default value is null. + * @member {string} [provisioningState] Provisioning state of the backend + * http settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayBackendHttpSettings + * + * @returns {object} metadata of ApplicationGatewayBackendHttpSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayBackendHttpSettings', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendHttpSettings', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'properties.port', + type: { + name: 'Number' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + cookieBasedAffinity: { + required: false, + serializedName: 'properties.cookieBasedAffinity', + type: { + name: 'String' + } + }, + requestTimeout: { + required: false, + serializedName: 'properties.requestTimeout', + type: { + name: 'Number' + } + }, + probe: { + required: false, + serializedName: 'properties.probe', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + authenticationCertificates: { + required: false, + serializedName: 'properties.authenticationCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + connectionDraining: { + required: false, + serializedName: 'properties.connectionDraining', + type: { + name: 'Composite', + className: 'ApplicationGatewayConnectionDraining' + } + }, + hostName: { + required: false, + serializedName: 'properties.hostName', + type: { + name: 'String' + } + }, + pickHostNameFromBackendAddress: { + required: false, + serializedName: 'properties.pickHostNameFromBackendAddress', + type: { + name: 'Boolean' + } + }, + affinityCookieName: { + required: false, + serializedName: 'properties.affinityCookieName', + type: { + name: 'String' + } + }, + probeEnabled: { + required: false, + serializedName: 'properties.probeEnabled', + type: { + name: 'Boolean' + } + }, + path: { + required: false, + serializedName: 'properties.path', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayBackendHttpSettings; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayConnectionDraining.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayConnectionDraining.js new file mode 100644 index 0000000000..657dfbc1ce --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayConnectionDraining.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'; + +/** + * Connection draining allows open connections to a backend server to be active + * for a specified time after the backend server got removed from the + * configuration. + * + */ +class ApplicationGatewayConnectionDraining { + /** + * Create a ApplicationGatewayConnectionDraining. + * @member {boolean} enabled Whether connection draining is enabled or not. + * @member {number} drainTimeoutInSec The number of seconds connection + * draining is active. Acceptable values are from 1 second to 3600 seconds. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayConnectionDraining + * + * @returns {object} metadata of ApplicationGatewayConnectionDraining + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayConnectionDraining', + type: { + name: 'Composite', + className: 'ApplicationGatewayConnectionDraining', + modelProperties: { + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + drainTimeoutInSec: { + required: true, + serializedName: 'drainTimeoutInSec', + constraints: { + InclusiveMaximum: 3600, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayConnectionDraining; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallDisabledRuleGroup.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallDisabledRuleGroup.js new file mode 100644 index 0000000000..fac27dfd71 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallDisabledRuleGroup.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Allows to disable rules within a rule group or an entire rule group. + * + */ +class ApplicationGatewayFirewallDisabledRuleGroup { + /** + * Create a ApplicationGatewayFirewallDisabledRuleGroup. + * @member {string} ruleGroupName The name of the rule group that will be + * disabled. + * @member {array} [rules] The list of rules that will be disabled. If null, + * all rules of the rule group will be disabled. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayFirewallDisabledRuleGroup + * + * @returns {object} metadata of ApplicationGatewayFirewallDisabledRuleGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFirewallDisabledRuleGroup', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallDisabledRuleGroup', + modelProperties: { + ruleGroupName: { + required: true, + serializedName: 'ruleGroupName', + type: { + name: 'String' + } + }, + rules: { + required: false, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NumberElementType', + type: { + name: 'Number' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFirewallDisabledRuleGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRule.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRule.js new file mode 100644 index 0000000000..73c4850657 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRule.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A web application firewall rule. + * + */ +class ApplicationGatewayFirewallRule { + /** + * Create a ApplicationGatewayFirewallRule. + * @member {number} ruleId The identifier of the web application firewall + * rule. + * @member {string} [description] The description of the web application + * firewall rule. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayFirewallRule + * + * @returns {object} metadata of ApplicationGatewayFirewallRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFirewallRule', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRule', + modelProperties: { + ruleId: { + required: true, + serializedName: 'ruleId', + type: { + name: 'Number' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFirewallRule; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleGroup.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleGroup.js new file mode 100644 index 0000000000..c359c16068 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleGroup.js @@ -0,0 +1,81 @@ +/* + * 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'); + +/** + * A web application firewall rule group. + * + */ +class ApplicationGatewayFirewallRuleGroup { + /** + * Create a ApplicationGatewayFirewallRuleGroup. + * @member {string} ruleGroupName The name of the web application firewall + * rule group. + * @member {string} [description] The description of the web application + * firewall rule group. + * @member {array} rules The rules of the web application firewall rule + * group. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayFirewallRuleGroup + * + * @returns {object} metadata of ApplicationGatewayFirewallRuleGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFirewallRuleGroup', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRuleGroup', + modelProperties: { + ruleGroupName: { + required: true, + serializedName: 'ruleGroupName', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + }, + rules: { + required: true, + serializedName: 'rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFirewallRuleElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRule' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFirewallRuleGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleSet.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleSet.js new file mode 100644 index 0000000000..d33762e006 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFirewallRuleSet.js @@ -0,0 +1,136 @@ +/* + * 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'); + +/** + * A web application firewall rule set. + * + * @extends models['Resource'] + */ +class ApplicationGatewayFirewallRuleSet extends models['Resource'] { + /** + * Create a ApplicationGatewayFirewallRuleSet. + * @member {string} [provisioningState] The provisioning state of the web + * application firewall rule set. + * @member {string} ruleSetType The type of the web application firewall rule + * set. + * @member {string} ruleSetVersion The version of the web application + * firewall rule set type. + * @member {array} ruleGroups The rule groups of the web application firewall + * rule set. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayFirewallRuleSet + * + * @returns {object} metadata of ApplicationGatewayFirewallRuleSet + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFirewallRuleSet', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRuleSet', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + ruleSetType: { + required: true, + serializedName: 'properties.ruleSetType', + type: { + name: 'String' + } + }, + ruleSetVersion: { + required: true, + serializedName: 'properties.ruleSetVersion', + type: { + name: 'String' + } + }, + ruleGroups: { + required: true, + serializedName: 'properties.ruleGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFirewallRuleGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallRuleGroup' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFirewallRuleSet; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendIPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendIPConfiguration.js new file mode 100644 index 0000000000..36c3964d12 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendIPConfiguration.js @@ -0,0 +1,128 @@ +/* + * 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'); + +/** + * Frontend IP configuration of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayFrontendIPConfiguration extends models['SubResource'] { + /** + * Create a ApplicationGatewayFrontendIPConfiguration. + * @member {string} [privateIPAddress] PrivateIPAddress of the network + * interface IP Configuration. + * @member {string} [privateIPAllocationMethod] PrivateIP allocation method. + * Possible values include: 'Static', 'Dynamic' + * @member {object} [subnet] Reference of the subnet resource. + * @member {string} [subnet.id] Resource ID. + * @member {object} [publicIPAddress] Reference of the PublicIP resource. + * @member {string} [publicIPAddress.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayFrontendIPConfiguration + * + * @returns {object} metadata of ApplicationGatewayFrontendIPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFrontendIPConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayFrontendIPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + privateIPAddress: { + required: false, + serializedName: 'properties.privateIPAddress', + type: { + name: 'String' + } + }, + privateIPAllocationMethod: { + required: false, + serializedName: 'properties.privateIPAllocationMethod', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + publicIPAddress: { + required: false, + serializedName: 'properties.publicIPAddress', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFrontendIPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendPort.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendPort.js new file mode 100644 index 0000000000..1eff4ee554 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayFrontendPort.js @@ -0,0 +1,98 @@ +/* + * 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'); + +/** + * Frontend port of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayFrontendPort extends models['SubResource'] { + /** + * Create a ApplicationGatewayFrontendPort. + * @member {number} [port] Frontend port + * @member {string} [provisioningState] Provisioning state of the frontend + * port resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayFrontendPort + * + * @returns {object} metadata of ApplicationGatewayFrontendPort + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayFrontendPort', + type: { + name: 'Composite', + className: 'ApplicationGatewayFrontendPort', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'properties.port', + type: { + name: 'Number' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayFrontendPort; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayHttpListener.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayHttpListener.js new file mode 100644 index 0000000000..edd2db76d3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayHttpListener.js @@ -0,0 +1,150 @@ +/* + * 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'); + +/** + * Http listener of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayHttpListener extends models['SubResource'] { + /** + * Create a ApplicationGatewayHttpListener. + * @member {object} [frontendIPConfiguration] Frontend IP configuration + * resource of an application gateway. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [frontendPort] Frontend port resource of an application + * gateway. + * @member {string} [frontendPort.id] Resource ID. + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [hostName] Host name of HTTP listener. + * @member {object} [sslCertificate] SSL certificate resource of an + * application gateway. + * @member {string} [sslCertificate.id] Resource ID. + * @member {boolean} [requireServerNameIndication] Applicable only if + * protocol is https. Enables SNI for multi-hosting. + * @member {string} [provisioningState] Provisioning state of the HTTP + * listener resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayHttpListener + * + * @returns {object} metadata of ApplicationGatewayHttpListener + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayHttpListener', + type: { + name: 'Composite', + className: 'ApplicationGatewayHttpListener', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + frontendIPConfiguration: { + required: false, + serializedName: 'properties.frontendIPConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + frontendPort: { + required: false, + serializedName: 'properties.frontendPort', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + hostName: { + required: false, + serializedName: 'properties.hostName', + type: { + name: 'String' + } + }, + sslCertificate: { + required: false, + serializedName: 'properties.sslCertificate', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + requireServerNameIndication: { + required: false, + serializedName: 'properties.requireServerNameIndication', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayHttpListener; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayIPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayIPConfiguration.js new file mode 100644 index 0000000000..6e170ed225 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayIPConfiguration.js @@ -0,0 +1,103 @@ +/* + * 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'); + +/** + * IP configuration of an application gateway. Currently 1 public and 1 private + * IP configuration is allowed. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayIPConfiguration extends models['SubResource'] { + /** + * Create a ApplicationGatewayIPConfiguration. + * @member {object} [subnet] Reference of the subnet resource. A subnet from + * where application gateway gets its private address. + * @member {string} [subnet.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the application + * gateway subnet resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayIPConfiguration + * + * @returns {object} metadata of ApplicationGatewayIPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayIPConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayIPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayIPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayListResult.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayListResult.js new file mode 100644 index 0000000000..faba3912d9 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayListResult.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'; + +/** + * Response for ListApplicationGateways API service call. + */ +class ApplicationGatewayListResult extends Array { + /** + * Create a ApplicationGatewayListResult. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayListResult + * + * @returns {object} metadata of ApplicationGatewayListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayListResult', + type: { + name: 'Composite', + className: 'ApplicationGatewayListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayElementType', + type: { + name: 'Composite', + className: 'ApplicationGateway' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayPathRule.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayPathRule.js new file mode 100644 index 0000000000..7f52241d11 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayPathRule.js @@ -0,0 +1,138 @@ +/* + * 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'); + +/** + * Path rule of URL path map of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayPathRule extends models['SubResource'] { + /** + * Create a ApplicationGatewayPathRule. + * @member {array} [paths] Path rules of URL path map. + * @member {object} [backendAddressPool] Backend address pool resource of URL + * path map path rule. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [backendHttpSettings] Backend http settings resource of + * URL path map path rule. + * @member {string} [backendHttpSettings.id] Resource ID. + * @member {object} [redirectConfiguration] Redirect configuration resource + * of URL path map path rule. + * @member {string} [redirectConfiguration.id] Resource ID. + * @member {string} [provisioningState] Path rule of URL path map resource. + * Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayPathRule + * + * @returns {object} metadata of ApplicationGatewayPathRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayPathRule', + type: { + name: 'Composite', + className: 'ApplicationGatewayPathRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + paths: { + required: false, + serializedName: 'properties.paths', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + backendAddressPool: { + required: false, + serializedName: 'properties.backendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + backendHttpSettings: { + required: false, + serializedName: 'properties.backendHttpSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + redirectConfiguration: { + required: false, + serializedName: 'properties.redirectConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayPathRule; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbe.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbe.js new file mode 100644 index 0000000000..78e535c3b8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbe.js @@ -0,0 +1,180 @@ +/* + * 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'); + +/** + * Probe of the application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayProbe extends models['SubResource'] { + /** + * Create a ApplicationGatewayProbe. + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [host] Host name to send the probe to. + * @member {string} [path] Relative path of probe. Valid path starts from + * '/'. Probe is sent to ://: + * @member {number} [interval] The probing interval in seconds. This is the + * time interval between two consecutive probes. Acceptable values are from 1 + * second to 86400 seconds. + * @member {number} [timeout] the probe timeout in seconds. Probe marked as + * failed if valid response is not received with this timeout period. + * Acceptable values are from 1 second to 86400 seconds. + * @member {number} [unhealthyThreshold] The probe retry count. Backend + * server is marked down after consecutive probe failure count reaches + * UnhealthyThreshold. Acceptable values are from 1 second to 20. + * @member {boolean} [pickHostNameFromBackendHttpSettings] Whether the host + * header should be picked from the backend http settings. Default value is + * false. + * @member {number} [minServers] Minimum number of servers that are always + * marked healthy. Default value is 0. + * @member {object} [match] Criterion for classifying a healthy probe + * response. + * @member {string} [match.body] Body that must be contained in the health + * response. Default value is empty. + * @member {array} [match.statusCodes] Allowed ranges of healthy status + * codes. Default range of healthy status codes is 200-399. + * @member {string} [provisioningState] Provisioning state of the backend + * http settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayProbe + * + * @returns {object} metadata of ApplicationGatewayProbe + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayProbe', + type: { + name: 'Composite', + className: 'ApplicationGatewayProbe', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + host: { + required: false, + serializedName: 'properties.host', + type: { + name: 'String' + } + }, + path: { + required: false, + serializedName: 'properties.path', + type: { + name: 'String' + } + }, + interval: { + required: false, + serializedName: 'properties.interval', + type: { + name: 'Number' + } + }, + timeout: { + required: false, + serializedName: 'properties.timeout', + type: { + name: 'Number' + } + }, + unhealthyThreshold: { + required: false, + serializedName: 'properties.unhealthyThreshold', + type: { + name: 'Number' + } + }, + pickHostNameFromBackendHttpSettings: { + required: false, + serializedName: 'properties.pickHostNameFromBackendHttpSettings', + type: { + name: 'Boolean' + } + }, + minServers: { + required: false, + serializedName: 'properties.minServers', + type: { + name: 'Number' + } + }, + match: { + required: false, + serializedName: 'properties.match', + type: { + name: 'Composite', + className: 'ApplicationGatewayProbeHealthResponseMatch' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayProbe; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbeHealthResponseMatch.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbeHealthResponseMatch.js new file mode 100644 index 0000000000..75068ec857 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayProbeHealthResponseMatch.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Application gateway probe health response match + * + */ +class ApplicationGatewayProbeHealthResponseMatch { + /** + * Create a ApplicationGatewayProbeHealthResponseMatch. + * @member {string} [body] Body that must be contained in the health + * response. Default value is empty. + * @member {array} [statusCodes] Allowed ranges of healthy status codes. + * Default range of healthy status codes is 200-399. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayProbeHealthResponseMatch + * + * @returns {object} metadata of ApplicationGatewayProbeHealthResponseMatch + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayProbeHealthResponseMatch', + type: { + name: 'Composite', + className: 'ApplicationGatewayProbeHealthResponseMatch', + modelProperties: { + body: { + required: false, + serializedName: 'body', + type: { + name: 'String' + } + }, + statusCodes: { + required: false, + serializedName: 'statusCodes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayProbeHealthResponseMatch; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayRedirectConfiguration.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayRedirectConfiguration.js new file mode 100644 index 0000000000..9e1947b563 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayRedirectConfiguration.js @@ -0,0 +1,177 @@ +/* + * 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'); + +/** + * Redirect configuration of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayRedirectConfiguration extends models['SubResource'] { + /** + * Create a ApplicationGatewayRedirectConfiguration. + * @member {string} [redirectType] Supported http redirection types - + * Permanent, Temporary, Found, SeeOther. Possible values include: + * 'Permanent', 'Found', 'SeeOther', 'Temporary' + * @member {object} [targetListener] Reference to a listener to redirect the + * request to. + * @member {string} [targetListener.id] Resource ID. + * @member {string} [targetUrl] Url to redirect the request to. + * @member {boolean} [includePath] Include path in the redirected url. + * @member {boolean} [includeQueryString] Include query string in the + * redirected url. + * @member {array} [requestRoutingRules] Request routing specifying redirect + * configuration. + * @member {array} [urlPathMaps] Url path maps specifying default redirect + * configuration. + * @member {array} [pathRules] Path rules specifying redirect configuration. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayRedirectConfiguration + * + * @returns {object} metadata of ApplicationGatewayRedirectConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayRedirectConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayRedirectConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + redirectType: { + required: false, + serializedName: 'properties.redirectType', + type: { + name: 'String' + } + }, + targetListener: { + required: false, + serializedName: 'properties.targetListener', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + targetUrl: { + required: false, + serializedName: 'properties.targetUrl', + type: { + name: 'String' + } + }, + includePath: { + required: false, + serializedName: 'properties.includePath', + type: { + name: 'Boolean' + } + }, + includeQueryString: { + required: false, + serializedName: 'properties.includeQueryString', + type: { + name: 'Boolean' + } + }, + requestRoutingRules: { + required: false, + serializedName: 'properties.requestRoutingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + urlPathMaps: { + required: false, + serializedName: 'properties.urlPathMaps', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + pathRules: { + required: false, + serializedName: 'properties.pathRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayRedirectConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayRequestRoutingRule.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayRequestRoutingRule.js new file mode 100644 index 0000000000..22878d6912 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayRequestRoutingRule.js @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Request routing rule of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayRequestRoutingRule extends models['SubResource'] { + /** + * Create a ApplicationGatewayRequestRoutingRule. + * @member {string} [ruleType] Rule type. Possible values include: 'Basic', + * 'PathBasedRouting' + * @member {object} [backendAddressPool] Backend address pool resource of the + * application gateway. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [backendHttpSettings] Frontend port resource of the + * application gateway. + * @member {string} [backendHttpSettings.id] Resource ID. + * @member {object} [httpListener] Http listener resource of the application + * gateway. + * @member {string} [httpListener.id] Resource ID. + * @member {object} [urlPathMap] URL path map resource of the application + * gateway. + * @member {string} [urlPathMap.id] Resource ID. + * @member {object} [redirectConfiguration] Redirect configuration resource + * of the application gateway. + * @member {string} [redirectConfiguration.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the request + * routing rule resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayRequestRoutingRule + * + * @returns {object} metadata of ApplicationGatewayRequestRoutingRule + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayRequestRoutingRule', + type: { + name: 'Composite', + className: 'ApplicationGatewayRequestRoutingRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + ruleType: { + required: false, + serializedName: 'properties.ruleType', + type: { + name: 'String' + } + }, + backendAddressPool: { + required: false, + serializedName: 'properties.backendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + backendHttpSettings: { + required: false, + serializedName: 'properties.backendHttpSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + httpListener: { + required: false, + serializedName: 'properties.httpListener', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + urlPathMap: { + required: false, + serializedName: 'properties.urlPathMap', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + redirectConfiguration: { + required: false, + serializedName: 'properties.redirectConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayRequestRoutingRule; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewaySku.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySku.js new file mode 100644 index 0000000000..2bf5af52f6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySku.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * SKU of an application gateway + * + */ +class ApplicationGatewaySku { + /** + * Create a ApplicationGatewaySku. + * @member {string} [name] Name of an application gateway SKU. Possible + * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', + * 'WAF_Medium', 'WAF_Large' + * @member {string} [tier] Tier of an application gateway. Possible values + * include: 'Standard', 'WAF' + * @member {number} [capacity] Capacity (instance count) of an application + * gateway. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewaySku + * + * @returns {object} metadata of ApplicationGatewaySku + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewaySku', + type: { + name: 'Composite', + className: 'ApplicationGatewaySku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + }, + capacity: { + required: false, + serializedName: 'capacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewaySku; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslCertificate.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslCertificate.js new file mode 100644 index 0000000000..0c13a53284 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslCertificate.js @@ -0,0 +1,118 @@ +/* + * 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'); + +/** + * SSL certificates of an application gateway. + * + * @extends models['SubResource'] + */ +class ApplicationGatewaySslCertificate extends models['SubResource'] { + /** + * Create a ApplicationGatewaySslCertificate. + * @member {string} [data] Base-64 encoded pfx certificate. Only applicable + * in PUT Request. + * @member {string} [password] Password for the pfx file specified in data. + * Only applicable in PUT request. + * @member {string} [publicCertData] Base-64 encoded Public cert data + * corresponding to pfx specified in data. Only applicable in GET request. + * @member {string} [provisioningState] Provisioning state of the SSL + * certificate resource Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewaySslCertificate + * + * @returns {object} metadata of ApplicationGatewaySslCertificate + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewaySslCertificate', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslCertificate', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + data: { + required: false, + serializedName: 'properties.data', + type: { + name: 'String' + } + }, + password: { + required: false, + serializedName: 'properties.password', + type: { + name: 'String' + } + }, + publicCertData: { + required: false, + serializedName: 'properties.publicCertData', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewaySslCertificate; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPolicy.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPolicy.js new file mode 100644 index 0000000000..1d1e7bdd49 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPolicy.js @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Application Gateway Ssl policy. + * + */ +class ApplicationGatewaySslPolicy { + /** + * Create a ApplicationGatewaySslPolicy. + * @member {array} [disabledSslProtocols] Ssl protocols to be disabled on + * application gateway. + * @member {string} [policyType] Type of Ssl Policy. Possible values include: + * 'Predefined', 'Custom' + * @member {string} [policyName] Name of Ssl predefined policy. Possible + * values include: 'AppGwSslPolicy20150501', 'AppGwSslPolicy20170401', + * 'AppGwSslPolicy20170401S' + * @member {array} [cipherSuites] Ssl cipher suites to be enabled in the + * specified order to application gateway. + * @member {string} [minProtocolVersion] Minimum version of Ssl protocol to + * be supported on application gateway. Possible values include: 'TLSv1_0', + * 'TLSv1_1', 'TLSv1_2' + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewaySslPolicy + * + * @returns {object} metadata of ApplicationGatewaySslPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewaySslPolicy', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslPolicy', + modelProperties: { + disabledSslProtocols: { + required: false, + serializedName: 'disabledSslProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + policyType: { + required: false, + serializedName: 'policyType', + type: { + name: 'String' + } + }, + policyName: { + required: false, + serializedName: 'policyName', + type: { + name: 'String' + } + }, + cipherSuites: { + required: false, + serializedName: 'cipherSuites', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + minProtocolVersion: { + required: false, + serializedName: 'minProtocolVersion', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewaySslPolicy; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPredefinedPolicy.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPredefinedPolicy.js new file mode 100644 index 0000000000..8c522f4c52 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewaySslPredefinedPolicy.js @@ -0,0 +1,89 @@ +/* + * 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'); + +/** + * An Ssl predefined policy + * + * @extends models['SubResource'] + */ +class ApplicationGatewaySslPredefinedPolicy extends models['SubResource'] { + /** + * Create a ApplicationGatewaySslPredefinedPolicy. + * @member {string} [name] Name of Ssl predefined policy. + * @member {array} [cipherSuites] Ssl cipher suites to be enabled in the + * specified order for application gateway. + * @member {string} [minProtocolVersion] Minimum version of Ssl protocol to + * be supported on application gateway. Possible values include: 'TLSv1_0', + * 'TLSv1_1', 'TLSv1_2' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewaySslPredefinedPolicy + * + * @returns {object} metadata of ApplicationGatewaySslPredefinedPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewaySslPredefinedPolicy', + type: { + name: 'Composite', + className: 'ApplicationGatewaySslPredefinedPolicy', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + cipherSuites: { + required: false, + serializedName: 'properties.cipherSuites', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + minProtocolVersion: { + required: false, + serializedName: 'properties.minProtocolVersion', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewaySslPredefinedPolicy; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayUrlPathMap.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayUrlPathMap.js new file mode 100644 index 0000000000..c49cf43292 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayUrlPathMap.js @@ -0,0 +1,141 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * UrlPathMaps give a url path to the backend mapping information for + * PathBasedRouting. + * + * @extends models['SubResource'] + */ +class ApplicationGatewayUrlPathMap extends models['SubResource'] { + /** + * Create a ApplicationGatewayUrlPathMap. + * @member {object} [defaultBackendAddressPool] Default backend address pool + * resource of URL path map. + * @member {string} [defaultBackendAddressPool.id] Resource ID. + * @member {object} [defaultBackendHttpSettings] Default backend http + * settings resource of URL path map. + * @member {string} [defaultBackendHttpSettings.id] Resource ID. + * @member {object} [defaultRedirectConfiguration] Default redirect + * configuration resource of URL path map. + * @member {string} [defaultRedirectConfiguration.id] Resource ID. + * @member {array} [pathRules] Path rule of URL path map resource. + * @member {string} [provisioningState] Provisioning state of the backend + * http settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Type of the resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationGatewayUrlPathMap + * + * @returns {object} metadata of ApplicationGatewayUrlPathMap + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayUrlPathMap', + type: { + name: 'Composite', + className: 'ApplicationGatewayUrlPathMap', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + defaultBackendAddressPool: { + required: false, + serializedName: 'properties.defaultBackendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + defaultBackendHttpSettings: { + required: false, + serializedName: 'properties.defaultBackendHttpSettings', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + defaultRedirectConfiguration: { + required: false, + serializedName: 'properties.defaultRedirectConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + pathRules: { + required: false, + serializedName: 'properties.pathRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayPathRuleElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayPathRule' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayUrlPathMap; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationGatewayWebApplicationFirewallConfiguration.js b/lib/services/networkManagement2/lib/lib/models/applicationGatewayWebApplicationFirewallConfiguration.js new file mode 100644 index 0000000000..188a421193 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationGatewayWebApplicationFirewallConfiguration.js @@ -0,0 +1,118 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Application gateway web application firewall configuration. + * + */ +class ApplicationGatewayWebApplicationFirewallConfiguration { + /** + * Create a ApplicationGatewayWebApplicationFirewallConfiguration. + * @member {boolean} enabled Whether the web application firewall is enabled + * or not. + * @member {string} firewallMode Web application firewall mode. Possible + * values include: 'Detection', 'Prevention' + * @member {string} ruleSetType The type of the web application firewall rule + * set. Possible values are: 'OWASP'. + * @member {string} ruleSetVersion The version of the rule set type. + * @member {array} [disabledRuleGroups] The disabled rule groups. + * @member {boolean} [requestBodyCheck] Whether allow WAF to check request + * Body. + * @member {number} [maxRequestBodySize] Maxium request body size for WAF. + */ + constructor() { + } + + /** + * Defines the metadata of ApplicationGatewayWebApplicationFirewallConfiguration + * + * @returns {object} metadata of ApplicationGatewayWebApplicationFirewallConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationGatewayWebApplicationFirewallConfiguration', + type: { + name: 'Composite', + className: 'ApplicationGatewayWebApplicationFirewallConfiguration', + modelProperties: { + enabled: { + required: true, + serializedName: 'enabled', + type: { + name: 'Boolean' + } + }, + firewallMode: { + required: true, + serializedName: 'firewallMode', + type: { + name: 'String' + } + }, + ruleSetType: { + required: true, + serializedName: 'ruleSetType', + type: { + name: 'String' + } + }, + ruleSetVersion: { + required: true, + serializedName: 'ruleSetVersion', + type: { + name: 'String' + } + }, + disabledRuleGroups: { + required: false, + serializedName: 'disabledRuleGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayFirewallDisabledRuleGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayFirewallDisabledRuleGroup' + } + } + } + }, + requestBodyCheck: { + required: false, + serializedName: 'requestBodyCheck', + type: { + name: 'Boolean' + } + }, + maxRequestBodySize: { + required: false, + serializedName: 'maxRequestBodySize', + constraints: { + InclusiveMaximum: 128, + InclusiveMinimum: 8 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ApplicationGatewayWebApplicationFirewallConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroup.js b/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroup.js new file mode 100644 index 0000000000..ee4bd13679 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroup.js @@ -0,0 +1,125 @@ +/* + * 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'); + +/** + * An application security group in a resource group. + * + * @extends models['Resource'] + */ +class ApplicationSecurityGroup extends models['Resource'] { + /** + * Create a ApplicationSecurityGroup. + * @member {string} [resourceGuid] The resource GUID property of the + * application security group resource. It uniquely identifies a resource, + * even if the user changes its name or migrate the resource across + * subscriptions or resource groups. + * @member {string} [provisioningState] The provisioning state of the + * application security group resource. Possible values are: 'Succeeded', + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationSecurityGroup + * + * @returns {object} metadata of ApplicationSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationSecurityGroup', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroup', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceGuid: { + required: false, + readOnly: true, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationSecurityGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroupListResult.js b/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroupListResult.js new file mode 100644 index 0000000000..0d6190e83a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/applicationSecurityGroupListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of application security groups. + */ +class ApplicationSecurityGroupListResult extends Array { + /** + * Create a ApplicationSecurityGroupListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ApplicationSecurityGroupListResult + * + * @returns {object} metadata of ApplicationSecurityGroupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ApplicationSecurityGroupListResult', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroupListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationSecurityGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroup' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ApplicationSecurityGroupListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/authorizationListResult.js b/lib/services/networkManagement2/lib/lib/models/authorizationListResult.js new file mode 100644 index 0000000000..187e7c18d8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/authorizationListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListAuthorizations API service call retrieves all + * authorizations that belongs to an ExpressRouteCircuit. + */ +class AuthorizationListResult extends Array { + /** + * Create a AuthorizationListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of AuthorizationListResult + * + * @returns {object} metadata of AuthorizationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AuthorizationListResult', + type: { + name: 'Composite', + className: 'AuthorizationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitAuthorizationElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitAuthorization' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AuthorizationListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/availability.js b/lib/services/networkManagement2/lib/lib/models/availability.js new file mode 100644 index 0000000000..87dab9ec37 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availability.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Availability of the metric. + * + */ +class Availability { + /** + * Create a Availability. + * @member {string} [timeGrain] The time grain of the availability. + * @member {string} [retention] The retention of the availability. + * @member {string} [blobDuration] Duration of the availability blob. + */ + constructor() { + } + + /** + * Defines the metadata of Availability + * + * @returns {object} metadata of Availability + * + */ + mapper() { + return { + required: false, + serializedName: 'Availability', + type: { + name: 'Composite', + className: 'Availability', + modelProperties: { + timeGrain: { + required: false, + serializedName: 'timeGrain', + type: { + name: 'String' + } + }, + retention: { + required: false, + serializedName: 'retention', + type: { + name: 'String' + } + }, + blobDuration: { + required: false, + serializedName: 'blobDuration', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Availability; diff --git a/lib/services/networkManagement2/lib/lib/models/availableProvidersList.js b/lib/services/networkManagement2/lib/lib/models/availableProvidersList.js new file mode 100644 index 0000000000..194eb44d45 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availableProvidersList.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * List of available countries with details. + * + */ +class AvailableProvidersList { + /** + * Create a AvailableProvidersList. + * @member {array} countries List of available countries. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableProvidersList + * + * @returns {object} metadata of AvailableProvidersList + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableProvidersList', + type: { + name: 'Composite', + className: 'AvailableProvidersList', + modelProperties: { + countries: { + required: true, + serializedName: 'countries', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AvailableProvidersListCountryElementType', + type: { + name: 'Composite', + className: 'AvailableProvidersListCountry' + } + } + } + } + } + } + }; + } +} + +module.exports = AvailableProvidersList; diff --git a/lib/services/networkManagement2/lib/lib/models/availableProvidersListCity.js b/lib/services/networkManagement2/lib/lib/models/availableProvidersListCity.js new file mode 100644 index 0000000000..24cc8393a9 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availableProvidersListCity.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'; + +/** + * City or town details. + * + */ +class AvailableProvidersListCity { + /** + * Create a AvailableProvidersListCity. + * @member {string} [cityName] The city or town name. + * @member {array} [providers] A list of Internet service providers. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableProvidersListCity + * + * @returns {object} metadata of AvailableProvidersListCity + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableProvidersListCity', + type: { + name: 'Composite', + className: 'AvailableProvidersListCity', + modelProperties: { + cityName: { + required: false, + serializedName: 'cityName', + type: { + name: 'String' + } + }, + providers: { + required: false, + serializedName: 'providers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = AvailableProvidersListCity; diff --git a/lib/services/networkManagement2/lib/lib/models/availableProvidersListCountry.js b/lib/services/networkManagement2/lib/lib/models/availableProvidersListCountry.js new file mode 100644 index 0000000000..e0377fb0f9 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availableProvidersListCountry.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'); + +/** + * Country details. + * + */ +class AvailableProvidersListCountry { + /** + * Create a AvailableProvidersListCountry. + * @member {string} [countryName] The country name. + * @member {array} [providers] A list of Internet service providers. + * @member {array} [states] List of available states in the country. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableProvidersListCountry + * + * @returns {object} metadata of AvailableProvidersListCountry + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableProvidersListCountry', + type: { + name: 'Composite', + className: 'AvailableProvidersListCountry', + modelProperties: { + countryName: { + required: false, + serializedName: 'countryName', + type: { + name: 'String' + } + }, + providers: { + required: false, + serializedName: 'providers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + states: { + required: false, + serializedName: 'states', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AvailableProvidersListStateElementType', + type: { + name: 'Composite', + className: 'AvailableProvidersListState' + } + } + } + } + } + } + }; + } +} + +module.exports = AvailableProvidersListCountry; diff --git a/lib/services/networkManagement2/lib/lib/models/availableProvidersListParameters.js b/lib/services/networkManagement2/lib/lib/models/availableProvidersListParameters.js new file mode 100644 index 0000000000..e3faef0eeb --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availableProvidersListParameters.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'; + +/** + * Constraints that determine the list of available Internet service providers. + * + */ +class AvailableProvidersListParameters { + /** + * Create a AvailableProvidersListParameters. + * @member {array} [azureLocations] A list of Azure regions. + * @member {string} [country] The country for available providers list. + * @member {string} [state] The state for available providers list. + * @member {string} [city] The city or town for available providers list. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableProvidersListParameters + * + * @returns {object} metadata of AvailableProvidersListParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableProvidersListParameters', + type: { + name: 'Composite', + className: 'AvailableProvidersListParameters', + modelProperties: { + azureLocations: { + required: false, + serializedName: 'azureLocations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + country: { + required: false, + serializedName: 'country', + type: { + name: 'String' + } + }, + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + city: { + required: false, + serializedName: 'city', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AvailableProvidersListParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/availableProvidersListState.js b/lib/services/networkManagement2/lib/lib/models/availableProvidersListState.js new file mode 100644 index 0000000000..238f7faf9e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/availableProvidersListState.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'); + +/** + * State details. + * + */ +class AvailableProvidersListState { + /** + * Create a AvailableProvidersListState. + * @member {string} [stateName] The state name. + * @member {array} [providers] A list of Internet service providers. + * @member {array} [cities] List of available cities or towns in the state. + */ + constructor() { + } + + /** + * Defines the metadata of AvailableProvidersListState + * + * @returns {object} metadata of AvailableProvidersListState + * + */ + mapper() { + return { + required: false, + serializedName: 'AvailableProvidersListState', + type: { + name: 'Composite', + className: 'AvailableProvidersListState', + modelProperties: { + stateName: { + required: false, + serializedName: 'stateName', + type: { + name: 'String' + } + }, + providers: { + required: false, + serializedName: 'providers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + cities: { + required: false, + serializedName: 'cities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AvailableProvidersListCityElementType', + type: { + name: 'Composite', + className: 'AvailableProvidersListCity' + } + } + } + } + } + } + }; + } +} + +module.exports = AvailableProvidersListState; diff --git a/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js b/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js new file mode 100644 index 0000000000..1552f7dda1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureAsyncOperationResult.js @@ -0,0 +1,77 @@ +/* + * 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 response body contains the status of the specified asynchronous + * operation, indicating whether it has succeeded, is in progress, or has + * failed. Note that this status is distinct from the HTTP status code returned + * for the Get Operation Status operation itself. If the asynchronous operation + * succeeded, the response body includes the HTTP status code for the + * successful request. If the asynchronous operation failed, the response body + * includes the HTTP status code for the failed request and error information + * regarding the failure. + * + */ +class AzureAsyncOperationResult { + /** + * Create a AzureAsyncOperationResult. + * @member {string} [status] Status of the Azure async operation. Possible + * values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values + * include: 'InProgress', 'Succeeded', 'Failed' + * @member {object} [error] + * @member {string} [error.code] + * @member {string} [error.message] + * @member {string} [error.target] + * @member {array} [error.details] + * @member {string} [error.innerError] + */ + constructor() { + } + + /** + * Defines the metadata of AzureAsyncOperationResult + * + * @returns {object} metadata of AzureAsyncOperationResult + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureAsyncOperationResult', + type: { + name: 'Composite', + className: 'AzureAsyncOperationResult', + modelProperties: { + status: { + required: false, + serializedName: 'status', + type: { + name: 'String' + } + }, + error: { + required: false, + serializedName: 'error', + type: { + name: 'Composite', + className: 'ErrorModel' + } + } + } + } + }; + } +} + +module.exports = AzureAsyncOperationResult; diff --git a/lib/services/networkManagement2/lib/lib/models/azureReachabilityReport.js b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReport.js new file mode 100644 index 0000000000..9519e3683c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReport.js @@ -0,0 +1,84 @@ +/* + * 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'); + +/** + * Azure reachability report details. + * + */ +class AzureReachabilityReport { + /** + * Create a AzureReachabilityReport. + * @member {string} aggregationLevel The aggregation level of Azure + * reachability report. Can be Country, State or City. + * @member {object} providerLocation + * @member {string} [providerLocation.country] The name of the country. + * @member {string} [providerLocation.state] The name of the state. + * @member {string} [providerLocation.city] The name of the city or town. + * @member {array} reachabilityReport List of Azure reachability report + * items. + */ + constructor() { + } + + /** + * Defines the metadata of AzureReachabilityReport + * + * @returns {object} metadata of AzureReachabilityReport + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureReachabilityReport', + type: { + name: 'Composite', + className: 'AzureReachabilityReport', + modelProperties: { + aggregationLevel: { + required: true, + serializedName: 'aggregationLevel', + type: { + name: 'String' + } + }, + providerLocation: { + required: true, + serializedName: 'providerLocation', + type: { + name: 'Composite', + className: 'AzureReachabilityReportLocation' + } + }, + reachabilityReport: { + required: true, + serializedName: 'reachabilityReport', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureReachabilityReportItemElementType', + type: { + name: 'Composite', + className: 'AzureReachabilityReportItem' + } + } + } + } + } + } + }; + } +} + +module.exports = AzureReachabilityReport; diff --git a/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportItem.js b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportItem.js new file mode 100644 index 0000000000..292f5f26b1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportItem.js @@ -0,0 +1,79 @@ +/* + * 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'); + +/** + * Azure reachability report details for a given provider location. + * + */ +class AzureReachabilityReportItem { + /** + * Create a AzureReachabilityReportItem. + * @member {string} [provider] The Internet service provider. + * @member {string} [azureLocation] The Azure region. + * @member {array} [latencies] List of latency details for each of the time + * series. + */ + constructor() { + } + + /** + * Defines the metadata of AzureReachabilityReportItem + * + * @returns {object} metadata of AzureReachabilityReportItem + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureReachabilityReportItem', + type: { + name: 'Composite', + className: 'AzureReachabilityReportItem', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + azureLocation: { + required: false, + serializedName: 'azureLocation', + type: { + name: 'String' + } + }, + latencies: { + required: false, + serializedName: 'latencies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AzureReachabilityReportLatencyInfoElementType', + type: { + name: 'Composite', + className: 'AzureReachabilityReportLatencyInfo' + } + } + } + } + } + } + }; + } +} + +module.exports = AzureReachabilityReportItem; diff --git a/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLatencyInfo.js b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLatencyInfo.js new file mode 100644 index 0000000000..48dab9ab63 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLatencyInfo.js @@ -0,0 +1,65 @@ +/* + * 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'; + +/** + * Details on latency for a time series. + * + */ +class AzureReachabilityReportLatencyInfo { + /** + * Create a AzureReachabilityReportLatencyInfo. + * @member {date} [timeStamp] The time stamp. + * @member {number} [score] The relative latency score between 1 and 100, + * higher values indicating a faster connection. + */ + constructor() { + } + + /** + * Defines the metadata of AzureReachabilityReportLatencyInfo + * + * @returns {object} metadata of AzureReachabilityReportLatencyInfo + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureReachabilityReportLatencyInfo', + type: { + name: 'Composite', + className: 'AzureReachabilityReportLatencyInfo', + modelProperties: { + timeStamp: { + required: false, + serializedName: 'timeStamp', + type: { + name: 'DateTime' + } + }, + score: { + required: false, + serializedName: 'score', + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = AzureReachabilityReportLatencyInfo; diff --git a/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLocation.js b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLocation.js new file mode 100644 index 0000000000..07582ba250 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportLocation.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters that define a geographic location. + * + */ +class AzureReachabilityReportLocation { + /** + * Create a AzureReachabilityReportLocation. + * @member {string} country The name of the country. + * @member {string} [state] The name of the state. + * @member {string} [city] The name of the city or town. + */ + constructor() { + } + + /** + * Defines the metadata of AzureReachabilityReportLocation + * + * @returns {object} metadata of AzureReachabilityReportLocation + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureReachabilityReportLocation', + type: { + name: 'Composite', + className: 'AzureReachabilityReportLocation', + modelProperties: { + country: { + required: true, + serializedName: 'country', + type: { + name: 'String' + } + }, + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + city: { + required: false, + serializedName: 'city', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = AzureReachabilityReportLocation; diff --git a/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportParameters.js b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportParameters.js new file mode 100644 index 0000000000..c9c96c1a94 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/azureReachabilityReportParameters.js @@ -0,0 +1,105 @@ +/* + * 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'); + +/** + * Geographic and time constraints for Azure reachability report. + * + */ +class AzureReachabilityReportParameters { + /** + * Create a AzureReachabilityReportParameters. + * @member {object} providerLocation + * @member {string} [providerLocation.country] The name of the country. + * @member {string} [providerLocation.state] The name of the state. + * @member {string} [providerLocation.city] The name of the city or town. + * @member {array} [providers] List of Internet service providers. + * @member {array} [azureLocations] Optional Azure regions to scope the query + * to. + * @member {date} startTime The start time for the Azure reachability report. + * @member {date} endTime The end time for the Azure reachability report. + */ + constructor() { + } + + /** + * Defines the metadata of AzureReachabilityReportParameters + * + * @returns {object} metadata of AzureReachabilityReportParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'AzureReachabilityReportParameters', + type: { + name: 'Composite', + className: 'AzureReachabilityReportParameters', + modelProperties: { + providerLocation: { + required: true, + serializedName: 'providerLocation', + type: { + name: 'Composite', + className: 'AzureReachabilityReportLocation' + } + }, + providers: { + required: false, + serializedName: 'providers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + azureLocations: { + required: false, + serializedName: 'azureLocations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + startTime: { + required: true, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: true, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + } + } + } + }; + } +} + +module.exports = AzureReachabilityReportParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/bGPCommunity.js b/lib/services/networkManagement2/lib/lib/models/bGPCommunity.js new file mode 100644 index 0000000000..aba7366bf6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bGPCommunity.js @@ -0,0 +1,106 @@ +/* + * 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'; + +/** + * Contains bgp community information offered in Service Community resources. + * + */ +class BGPCommunity { + /** + * Create a BGPCommunity. + * @member {string} [serviceSupportedRegion] The region which the service + * support. e.g. For O365, region is Global. + * @member {string} [communityName] The name of the bgp community. e.g. + * Skype. + * @member {string} [communityValue] The value of the bgp community. For more + * information: + * https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + * @member {array} [communityPrefixes] The prefixes that the bgp community + * contains. + * @member {boolean} [isAuthorizedToUse] Customer is authorized to use bgp + * community or not. + * @member {string} [serviceGroup] The service group of the bgp community + * contains. + */ + constructor() { + } + + /** + * Defines the metadata of BGPCommunity + * + * @returns {object} metadata of BGPCommunity + * + */ + mapper() { + return { + required: false, + serializedName: 'BGPCommunity', + type: { + name: 'Composite', + className: 'BGPCommunity', + modelProperties: { + serviceSupportedRegion: { + required: false, + serializedName: 'serviceSupportedRegion', + type: { + name: 'String' + } + }, + communityName: { + required: false, + serializedName: 'communityName', + type: { + name: 'String' + } + }, + communityValue: { + required: false, + serializedName: 'communityValue', + type: { + name: 'String' + } + }, + communityPrefixes: { + required: false, + serializedName: 'communityPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + isAuthorizedToUse: { + required: false, + serializedName: 'isAuthorizedToUse', + type: { + name: 'Boolean' + } + }, + serviceGroup: { + required: false, + serializedName: 'serviceGroup', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BGPCommunity; diff --git a/lib/services/networkManagement2/lib/lib/models/backendAddressPool.js b/lib/services/networkManagement2/lib/lib/models/backendAddressPool.js new file mode 100644 index 0000000000..5311a4e163 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/backendAddressPool.js @@ -0,0 +1,130 @@ +/* + * 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'); + +/** + * Pool of backend IP addresses. + * + * @extends models['SubResource'] + */ +class BackendAddressPool extends models['SubResource'] { + /** + * Create a BackendAddressPool. + * @member {array} [backendIPConfigurations] Gets collection of references to + * IP addresses defined in network interfaces. + * @member {array} [loadBalancingRules] Gets load balancing rules that use + * this backend address pool. + * @member {object} [outboundNatRule] Gets outbound rules that use this + * backend address pool. + * @member {string} [outboundNatRule.id] Resource ID. + * @member {string} [provisioningState] Get provisioning state of the public + * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BackendAddressPool + * + * @returns {object} metadata of BackendAddressPool + * + */ + mapper() { + return { + required: false, + serializedName: 'BackendAddressPool', + type: { + name: 'Composite', + className: 'BackendAddressPool', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + backendIPConfigurations: { + required: false, + readOnly: true, + serializedName: 'properties.backendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceIPConfigurationElementType', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + } + } + }, + loadBalancingRules: { + required: false, + readOnly: true, + serializedName: 'properties.loadBalancingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + outboundNatRule: { + required: false, + readOnly: true, + serializedName: 'properties.outboundNatRule', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BackendAddressPool; diff --git a/lib/services/networkManagement2/lib/lib/models/bgpPeerStatus.js b/lib/services/networkManagement2/lib/lib/models/bgpPeerStatus.js new file mode 100644 index 0000000000..1bd7bbb91b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bgpPeerStatus.js @@ -0,0 +1,119 @@ +/* + * 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'; + +/** + * BGP peer status details + * + */ +class BgpPeerStatus { + /** + * Create a BgpPeerStatus. + * @member {string} [localAddress] The virtual network gateway's local + * address + * @member {string} [neighbor] The remote BGP peer + * @member {number} [asn] The autonomous system number of the remote BGP peer + * @member {string} [state] The BGP peer state. Possible values include: + * 'Unknown', 'Stopped', 'Idle', 'Connecting', 'Connected' + * @member {string} [connectedDuration] For how long the peering has been up + * @member {number} [routesReceived] The number of routes learned from this + * peer + * @member {number} [messagesSent] The number of BGP messages sent + * @member {number} [messagesReceived] The number of BGP messages received + */ + constructor() { + } + + /** + * Defines the metadata of BgpPeerStatus + * + * @returns {object} metadata of BgpPeerStatus + * + */ + mapper() { + return { + required: false, + serializedName: 'BgpPeerStatus', + type: { + name: 'Composite', + className: 'BgpPeerStatus', + modelProperties: { + localAddress: { + required: false, + readOnly: true, + serializedName: 'localAddress', + type: { + name: 'String' + } + }, + neighbor: { + required: false, + readOnly: true, + serializedName: 'neighbor', + type: { + name: 'String' + } + }, + asn: { + required: false, + readOnly: true, + serializedName: 'asn', + type: { + name: 'Number' + } + }, + state: { + required: false, + readOnly: true, + serializedName: 'state', + type: { + name: 'String' + } + }, + connectedDuration: { + required: false, + readOnly: true, + serializedName: 'connectedDuration', + type: { + name: 'String' + } + }, + routesReceived: { + required: false, + readOnly: true, + serializedName: 'routesReceived', + type: { + name: 'Number' + } + }, + messagesSent: { + required: false, + readOnly: true, + serializedName: 'messagesSent', + type: { + name: 'Number' + } + }, + messagesReceived: { + required: false, + readOnly: true, + serializedName: 'messagesReceived', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = BgpPeerStatus; diff --git a/lib/services/networkManagement2/lib/lib/models/bgpPeerStatusListResult.js b/lib/services/networkManagement2/lib/lib/models/bgpPeerStatusListResult.js new file mode 100644 index 0000000000..ef14531f3f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bgpPeerStatusListResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Response for list BGP peer status API service call + * + */ +class BgpPeerStatusListResult { + /** + * Create a BgpPeerStatusListResult. + * @member {array} [value] List of BGP peers + */ + constructor() { + } + + /** + * Defines the metadata of BgpPeerStatusListResult + * + * @returns {object} metadata of BgpPeerStatusListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BgpPeerStatusListResult', + type: { + name: 'Composite', + className: 'BgpPeerStatusListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BgpPeerStatusElementType', + type: { + name: 'Composite', + className: 'BgpPeerStatus' + } + } + } + } + } + } + }; + } +} + +module.exports = BgpPeerStatusListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunity.js b/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunity.js new file mode 100644 index 0000000000..4a174fe080 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunity.js @@ -0,0 +1,116 @@ +/* + * 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'); + +/** + * Service Community Properties. + * + * @extends models['Resource'] + */ +class BgpServiceCommunity extends models['Resource'] { + /** + * Create a BgpServiceCommunity. + * @member {string} [serviceName] The name of the bgp community. e.g. Skype. + * @member {array} [bgpCommunities] Get a list of bgp communities. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BgpServiceCommunity + * + * @returns {object} metadata of BgpServiceCommunity + * + */ + mapper() { + return { + required: false, + serializedName: 'BgpServiceCommunity', + type: { + name: 'Composite', + className: 'BgpServiceCommunity', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + serviceName: { + required: false, + serializedName: 'properties.serviceName', + type: { + name: 'String' + } + }, + bgpCommunities: { + required: false, + serializedName: 'properties.bgpCommunities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BGPCommunityElementType', + type: { + name: 'Composite', + className: 'BGPCommunity' + } + } + } + } + } + } + }; + } +} + +module.exports = BgpServiceCommunity; diff --git a/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunityListResult.js b/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunityListResult.js new file mode 100644 index 0000000000..7db298d442 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bgpServiceCommunityListResult.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'; + +/** + * Response for the ListServiceCommunity API service call. + */ +class BgpServiceCommunityListResult extends Array { + /** + * Create a BgpServiceCommunityListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of BgpServiceCommunityListResult + * + * @returns {object} metadata of BgpServiceCommunityListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'BgpServiceCommunityListResult', + type: { + name: 'Composite', + className: 'BgpServiceCommunityListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BgpServiceCommunityElementType', + type: { + name: 'Composite', + className: 'BgpServiceCommunity' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = BgpServiceCommunityListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/bgpSettings.js b/lib/services/networkManagement2/lib/lib/models/bgpSettings.js new file mode 100644 index 0000000000..dca7b0f07c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/bgpSettings.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'; + +/** + * BGP settings details + * + */ +class BgpSettings { + /** + * Create a BgpSettings. + * @member {number} [asn] The BGP speaker's ASN. + * @member {string} [bgpPeeringAddress] The BGP peering address and BGP + * identifier of this BGP speaker. + * @member {number} [peerWeight] The weight added to routes learned from this + * BGP speaker. + */ + constructor() { + } + + /** + * Defines the metadata of BgpSettings + * + * @returns {object} metadata of BgpSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'BgpSettings', + type: { + name: 'Composite', + className: 'BgpSettings', + modelProperties: { + asn: { + required: false, + serializedName: 'asn', + type: { + name: 'Number' + } + }, + bgpPeeringAddress: { + required: false, + serializedName: 'bgpPeeringAddress', + type: { + name: 'String' + } + }, + peerWeight: { + required: false, + serializedName: 'peerWeight', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = BgpSettings; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitor.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitor.js new file mode 100644 index 0000000000..d690fcf86d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitor.js @@ -0,0 +1,116 @@ +/* + * 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 that define the operation to create a connection monitor. + * + */ +class ConnectionMonitor { + /** + * Create a ConnectionMonitor. + * @member {string} [location] Connection monitor location. + * @member {object} [tags] Connection monitor tags. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as + * the destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by + * connection monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitor + * + * @returns {object} metadata of ConnectionMonitor + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitor', + type: { + name: 'Composite', + className: 'ConnectionMonitor', + modelProperties: { + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ConnectionMonitorSource' + } + }, + destination: { + required: true, + serializedName: 'properties.destination', + type: { + name: 'Composite', + className: 'ConnectionMonitorDestination' + } + }, + autoStart: { + required: false, + serializedName: 'properties.autoStart', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + monitoringIntervalInSeconds: { + required: false, + serializedName: 'properties.monitoringIntervalInSeconds', + defaultValue: 60, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitor; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorDestination.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorDestination.js new file mode 100644 index 0000000000..063b721c85 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorDestination.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'; + +/** + * Describes the destination of connection monitor. + * + */ +class ConnectionMonitorDestination { + /** + * Create a ConnectionMonitorDestination. + * @member {string} [resourceId] The ID of the resource used as the + * destination by connection monitor. + * @member {string} [address] Address of the connection monitor destination + * (IP or domain name). + * @member {number} [port] The destination port used by connection monitor. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitorDestination + * + * @returns {object} metadata of ConnectionMonitorDestination + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorDestination', + type: { + name: 'Composite', + className: 'ConnectionMonitorDestination', + modelProperties: { + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + address: { + required: false, + serializedName: 'address', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorDestination; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorListResult.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorListResult.js new file mode 100644 index 0000000000..d9a476a324 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorListResult.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'; + +/** + * List of connection monitors. + */ +class ConnectionMonitorListResult extends Array { + /** + * Create a ConnectionMonitorListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ConnectionMonitorListResult + * + * @returns {object} metadata of ConnectionMonitorListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorListResult', + type: { + name: 'Composite', + className: 'ConnectionMonitorListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionMonitorResultElementType', + type: { + name: 'Composite', + className: 'ConnectionMonitorResult' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorParameters.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorParameters.js new file mode 100644 index 0000000000..513f5d6b79 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorParameters.js @@ -0,0 +1,93 @@ +/* + * 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 that define the operation to create a connection monitor. + * + */ +class ConnectionMonitorParameters { + /** + * Create a ConnectionMonitorParameters. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as + * the destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by + * connection monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitorParameters + * + * @returns {object} metadata of ConnectionMonitorParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorParameters', + type: { + name: 'Composite', + className: 'ConnectionMonitorParameters', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ConnectionMonitorSource' + } + }, + destination: { + required: true, + serializedName: 'destination', + type: { + name: 'Composite', + className: 'ConnectionMonitorDestination' + } + }, + autoStart: { + required: false, + serializedName: 'autoStart', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + monitoringIntervalInSeconds: { + required: false, + serializedName: 'monitoringIntervalInSeconds', + defaultValue: 60, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorQueryResult.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorQueryResult.js new file mode 100644 index 0000000000..8b78a35d32 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorQueryResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * List of connection states snaphots. + * + */ +class ConnectionMonitorQueryResult { + /** + * Create a ConnectionMonitorQueryResult. + * @member {array} [states] Information about connection states. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitorQueryResult + * + * @returns {object} metadata of ConnectionMonitorQueryResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorQueryResult', + type: { + name: 'Composite', + className: 'ConnectionMonitorQueryResult', + modelProperties: { + states: { + required: false, + serializedName: 'states', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectionStateSnapshotElementType', + type: { + name: 'Composite', + className: 'ConnectionStateSnapshot' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorQueryResult; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorResult.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorResult.js new file mode 100644 index 0000000000..a26ce4b8f8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorResult.js @@ -0,0 +1,183 @@ +/* + * 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'); + +/** + * Information about the connection monitor. + * + * @extends models['BaseResource'] + */ +class ConnectionMonitorResult extends models['BaseResource'] { + /** + * Create a ConnectionMonitorResult. + * @member {string} [name] Name of the connection monitor. + * @member {string} [id] ID of the connection monitor. + * @member {string} [etag] Default value: 'A unique read-only string that + * changes whenever the resource is updated.' . + * @member {string} [type] Connection monitor type. + * @member {string} [location] Connection monitor location. + * @member {object} [tags] Connection monitor tags. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as + * the destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by + * connection monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + * @member {string} [provisioningState] The provisioning state of the + * connection monitor. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * @member {date} [startTime] The date and time when the connection monitor + * was started. + * @member {string} [monitoringStatus] The monitoring status of the + * connection monitor. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ConnectionMonitorResult + * + * @returns {object} metadata of ConnectionMonitorResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorResult', + type: { + name: 'Composite', + className: 'ConnectionMonitorResult', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + defaultValue: 'A unique read-only string that changes whenever the resource is updated.', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + source: { + required: true, + serializedName: 'properties.source', + type: { + name: 'Composite', + className: 'ConnectionMonitorSource' + } + }, + destination: { + required: true, + serializedName: 'properties.destination', + type: { + name: 'Composite', + className: 'ConnectionMonitorDestination' + } + }, + autoStart: { + required: false, + serializedName: 'properties.autoStart', + defaultValue: true, + type: { + name: 'Boolean' + } + }, + monitoringIntervalInSeconds: { + required: false, + serializedName: 'properties.monitoringIntervalInSeconds', + defaultValue: 60, + type: { + name: 'Number' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'properties.startTime', + type: { + name: 'DateTime' + } + }, + monitoringStatus: { + required: false, + serializedName: 'properties.monitoringStatus', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorResult; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionMonitorSource.js b/lib/services/networkManagement2/lib/lib/models/connectionMonitorSource.js new file mode 100644 index 0000000000..135c604d84 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionMonitorSource.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'; + +/** + * Describes the source of connection monitor. + * + */ +class ConnectionMonitorSource { + /** + * Create a ConnectionMonitorSource. + * @member {string} resourceId The ID of the resource used as the source by + * connection monitor. + * @member {number} [port] The source port used by connection monitor. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionMonitorSource + * + * @returns {object} metadata of ConnectionMonitorSource + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionMonitorSource', + type: { + name: 'Composite', + className: 'ConnectionMonitorSource', + modelProperties: { + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectionMonitorSource; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionResetSharedKey.js b/lib/services/networkManagement2/lib/lib/models/connectionResetSharedKey.js new file mode 100644 index 0000000000..1e6a955c42 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionResetSharedKey.js @@ -0,0 +1,57 @@ +/* + * 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'; + +/** + * The virtual network connection reset shared key + * + */ +class ConnectionResetSharedKey { + /** + * Create a ConnectionResetSharedKey. + * @member {number} keyLength The virtual network connection reset shared key + * length, should between 1 and 128. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionResetSharedKey + * + * @returns {object} metadata of ConnectionResetSharedKey + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionResetSharedKey', + type: { + name: 'Composite', + className: 'ConnectionResetSharedKey', + modelProperties: { + keyLength: { + required: true, + serializedName: 'keyLength', + constraints: { + InclusiveMaximum: 128, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectionResetSharedKey; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionSharedKey.js b/lib/services/networkManagement2/lib/lib/models/connectionSharedKey.js new file mode 100644 index 0000000000..a74b9eeeca --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionSharedKey.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for GetConnectionSharedKey API service call + * + */ +class ConnectionSharedKey { + /** + * Create a ConnectionSharedKey. + * @member {string} value The virtual network connection shared key value. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionSharedKey + * + * @returns {object} metadata of ConnectionSharedKey + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionSharedKey', + type: { + name: 'Composite', + className: 'ConnectionSharedKey', + modelProperties: { + value: { + required: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ConnectionSharedKey; diff --git a/lib/services/networkManagement2/lib/lib/models/connectionStateSnapshot.js b/lib/services/networkManagement2/lib/lib/models/connectionStateSnapshot.js new file mode 100644 index 0000000000..ccf3aeec06 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectionStateSnapshot.js @@ -0,0 +1,98 @@ +/* + * 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'); + +/** + * Connection state snapshot. + * + */ +class ConnectionStateSnapshot { + /** + * Create a ConnectionStateSnapshot. + * @member {string} [connectionState] The connection state. Possible values + * include: 'Reachable', 'Unreachable', 'Unknown' + * @member {date} [startTime] The start time of the connection snapshot. + * @member {date} [endTime] The end time of the connection snapshot. + * @member {string} [evaluationState] Connectivity analysis evaluation state. + * Possible values include: 'NotStarted', 'InProgress', 'Completed' + * @member {array} [hops] List of hops between the source and the + * destination. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectionStateSnapshot + * + * @returns {object} metadata of ConnectionStateSnapshot + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectionStateSnapshot', + type: { + name: 'Composite', + className: 'ConnectionStateSnapshot', + modelProperties: { + connectionState: { + required: false, + serializedName: 'connectionState', + type: { + name: 'String' + } + }, + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + evaluationState: { + required: false, + serializedName: 'evaluationState', + type: { + name: 'String' + } + }, + hops: { + required: false, + readOnly: true, + serializedName: 'hops', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectivityHopElementType', + type: { + name: 'Composite', + className: 'ConnectivityHop' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectionStateSnapshot; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivityDestination.js b/lib/services/networkManagement2/lib/lib/models/connectivityDestination.js new file mode 100644 index 0000000000..e5fa257881 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivityDestination.js @@ -0,0 +1,71 @@ +/* + * 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 that define destination of connection. + * + */ +class ConnectivityDestination { + /** + * Create a ConnectivityDestination. + * @member {string} [resourceId] The ID of the resource to which a connection + * attempt will be made. + * @member {string} [address] The IP address or URI the resource to which a + * connection attempt will be made. + * @member {number} [port] Port on which check connectivity will be + * performed. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivityDestination + * + * @returns {object} metadata of ConnectivityDestination + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivityDestination', + type: { + name: 'Composite', + className: 'ConnectivityDestination', + modelProperties: { + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + address: { + required: false, + serializedName: 'address', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectivityDestination; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivityHop.js b/lib/services/networkManagement2/lib/lib/models/connectivityHop.js new file mode 100644 index 0000000000..dd478e4963 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivityHop.js @@ -0,0 +1,116 @@ +/* + * 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'); + +/** + * Information about a hop between the source and the destination. + * + */ +class ConnectivityHop { + /** + * Create a ConnectivityHop. + * @member {string} [type] The type of the hop. + * @member {string} [id] The ID of the hop. + * @member {string} [address] The IP address of the hop. + * @member {string} [resourceId] The ID of the resource corresponding to this + * hop. + * @member {array} [nextHopIds] List of next hop identifiers. + * @member {array} [issues] List of issues. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivityHop + * + * @returns {object} metadata of ConnectivityHop + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivityHop', + type: { + name: 'Composite', + className: 'ConnectivityHop', + modelProperties: { + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + address: { + required: false, + readOnly: true, + serializedName: 'address', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + readOnly: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + nextHopIds: { + required: false, + readOnly: true, + serializedName: 'nextHopIds', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + issues: { + required: false, + readOnly: true, + serializedName: 'issues', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectivityIssueElementType', + type: { + name: 'Composite', + className: 'ConnectivityIssue' + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectivityHop; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivityInformation.js b/lib/services/networkManagement2/lib/lib/models/connectivityInformation.js new file mode 100644 index 0000000000..4f238a8b0d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivityInformation.js @@ -0,0 +1,119 @@ +/* + * 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'); + +/** + * Information on the connectivity status. + * + */ +class ConnectivityInformation { + /** + * Create a ConnectivityInformation. + * @member {array} [hops] List of hops between the source and the + * destination. + * @member {string} [connectionStatus] The connection status. Possible values + * include: 'Unknown', 'Connected', 'Disconnected', 'Degraded' + * @member {number} [avgLatencyInMs] Average latency in milliseconds. + * @member {number} [minLatencyInMs] Minimum latency in milliseconds. + * @member {number} [maxLatencyInMs] Maximum latency in milliseconds. + * @member {number} [probesSent] Total number of probes sent. + * @member {number} [probesFailed] Number of failed probes. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivityInformation + * + * @returns {object} metadata of ConnectivityInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivityInformation', + type: { + name: 'Composite', + className: 'ConnectivityInformation', + modelProperties: { + hops: { + required: false, + readOnly: true, + serializedName: 'hops', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ConnectivityHopElementType', + type: { + name: 'Composite', + className: 'ConnectivityHop' + } + } + } + }, + connectionStatus: { + required: false, + readOnly: true, + serializedName: 'connectionStatus', + type: { + name: 'String' + } + }, + avgLatencyInMs: { + required: false, + readOnly: true, + serializedName: 'avgLatencyInMs', + type: { + name: 'Number' + } + }, + minLatencyInMs: { + required: false, + readOnly: true, + serializedName: 'minLatencyInMs', + type: { + name: 'Number' + } + }, + maxLatencyInMs: { + required: false, + readOnly: true, + serializedName: 'maxLatencyInMs', + type: { + name: 'Number' + } + }, + probesSent: { + required: false, + readOnly: true, + serializedName: 'probesSent', + type: { + name: 'Number' + } + }, + probesFailed: { + required: false, + readOnly: true, + serializedName: 'probesFailed', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectivityInformation; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivityIssue.js b/lib/services/networkManagement2/lib/lib/models/connectivityIssue.js new file mode 100644 index 0000000000..573c4f2c17 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivityIssue.js @@ -0,0 +1,99 @@ +/* + * 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'; + +/** + * Information about an issue encountered in the process of checking for + * connectivity. + * + */ +class ConnectivityIssue { + /** + * Create a ConnectivityIssue. + * @member {string} [origin] The origin of the issue. Possible values + * include: 'Local', 'Inbound', 'Outbound' + * @member {string} [severity] The severity of the issue. Possible values + * include: 'Error', 'Warning' + * @member {string} [type] The type of issue. Possible values include: + * 'Unknown', 'AgentStopped', 'GuestFirewall', 'DnsResolution', 'SocketBind', + * 'NetworkSecurityRule', 'UserDefinedRoute', 'PortThrottled', 'Platform' + * @member {array} [context] Provides additional context on the issue. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivityIssue + * + * @returns {object} metadata of ConnectivityIssue + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivityIssue', + type: { + name: 'Composite', + className: 'ConnectivityIssue', + modelProperties: { + origin: { + required: false, + readOnly: true, + serializedName: 'origin', + type: { + name: 'String' + } + }, + severity: { + required: false, + readOnly: true, + serializedName: 'severity', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + context: { + required: false, + readOnly: true, + serializedName: 'context', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ObjectElementType', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + } + }; + } +} + +module.exports = ConnectivityIssue; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivityParameters.js b/lib/services/networkManagement2/lib/lib/models/connectivityParameters.js new file mode 100644 index 0000000000..28edbba72a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivityParameters.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'); + +/** + * Parameters that determine how the connectivity check will be performed. + * + */ +class ConnectivityParameters { + /** + * Create a ConnectivityParameters. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource from which a + * connectivity check will be initiated. + * @member {number} [source.port] The source port from which a connectivity + * check will be performed. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource to which + * a connection attempt will be made. + * @member {string} [destination.address] The IP address or URI the resource + * to which a connection attempt will be made. + * @member {number} [destination.port] Port on which check connectivity will + * be performed. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivityParameters + * + * @returns {object} metadata of ConnectivityParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivityParameters', + type: { + name: 'Composite', + className: 'ConnectivityParameters', + modelProperties: { + source: { + required: true, + serializedName: 'source', + type: { + name: 'Composite', + className: 'ConnectivitySource' + } + }, + destination: { + required: true, + serializedName: 'destination', + type: { + name: 'Composite', + className: 'ConnectivityDestination' + } + } + } + } + }; + } +} + +module.exports = ConnectivityParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/connectivitySource.js b/lib/services/networkManagement2/lib/lib/models/connectivitySource.js new file mode 100644 index 0000000000..a27b2ab62e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/connectivitySource.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Parameters that define the source of the connection. + * + */ +class ConnectivitySource { + /** + * Create a ConnectivitySource. + * @member {string} resourceId The ID of the resource from which a + * connectivity check will be initiated. + * @member {number} [port] The source port from which a connectivity check + * will be performed. + */ + constructor() { + } + + /** + * Defines the metadata of ConnectivitySource + * + * @returns {object} metadata of ConnectivitySource + * + */ + mapper() { + return { + required: false, + serializedName: 'ConnectivitySource', + type: { + name: 'Composite', + className: 'ConnectivitySource', + modelProperties: { + resourceId: { + required: true, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + port: { + required: false, + serializedName: 'port', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ConnectivitySource; diff --git a/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlan.js b/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlan.js new file mode 100644 index 0000000000..d246e24d1f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlan.js @@ -0,0 +1,143 @@ +/* + * 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'); + +/** + * A DDoS protection plan in a resource group. + * + * @extends models['Resource'] + */ +class DdosProtectionPlan extends models['Resource'] { + /** + * Create a DdosProtectionPlan. + * @member {string} [resourceGuid] The resource GUID property of the DDoS + * protection plan resource. It uniquely identifies the resource, even if the + * user changes its name or migrate the resource across subscriptions or + * resource groups. + * @member {string} [provisioningState] The provisioning state of the DDoS + * protection plan resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {array} [virtualNetworks] The list of virtual networks associated + * with the DDoS protection plan resource. This list is read-only. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DdosProtectionPlan + * + * @returns {object} metadata of DdosProtectionPlan + * + */ + mapper() { + return { + required: false, + serializedName: 'DdosProtectionPlan', + type: { + name: 'Composite', + className: 'DdosProtectionPlan', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + resourceGuid: { + required: false, + readOnly: true, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + virtualNetworks: { + required: false, + readOnly: true, + serializedName: 'properties.virtualNetworks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DdosProtectionPlan; diff --git a/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlanListResult.js b/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlanListResult.js new file mode 100644 index 0000000000..076979f5cd --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/ddosProtectionPlanListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * A list of DDoS protection plans. + */ +class DdosProtectionPlanListResult extends Array { + /** + * Create a DdosProtectionPlanListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of DdosProtectionPlanListResult + * + * @returns {object} metadata of DdosProtectionPlanListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DdosProtectionPlanListResult', + type: { + name: 'Composite', + className: 'DdosProtectionPlanListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DdosProtectionPlanElementType', + type: { + name: 'Composite', + className: 'DdosProtectionPlan' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = DdosProtectionPlanListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/dhcpOptions.js b/lib/services/networkManagement2/lib/lib/models/dhcpOptions.js new file mode 100644 index 0000000000..a610247325 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/dhcpOptions.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'; + +/** + * DhcpOptions contains an array of DNS servers available to VMs deployed in + * the virtual network. Standard DHCP option for a subnet overrides VNET DHCP + * options. + * + */ +class DhcpOptions { + /** + * Create a DhcpOptions. + * @member {array} [dnsServers] The list of DNS servers IP addresses. + */ + constructor() { + } + + /** + * Defines the metadata of DhcpOptions + * + * @returns {object} metadata of DhcpOptions + * + */ + mapper() { + return { + required: false, + serializedName: 'DhcpOptions', + type: { + name: 'Composite', + className: 'DhcpOptions', + modelProperties: { + dnsServers: { + required: false, + serializedName: 'dnsServers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = DhcpOptions; diff --git a/lib/services/networkManagement2/lib/lib/models/dimension.js b/lib/services/networkManagement2/lib/lib/models/dimension.js new file mode 100644 index 0000000000..2f79fd6dd3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/dimension.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Dimension of the metric. + * + */ +class Dimension { + /** + * Create a Dimension. + * @member {string} [name] The name of the dimension. + * @member {string} [displayName] The display name of the dimension. + * @member {string} [internalName] The internal name of the dimension. + */ + constructor() { + } + + /** + * Defines the metadata of Dimension + * + * @returns {object} metadata of Dimension + * + */ + mapper() { + return { + required: false, + serializedName: 'Dimension', + type: { + name: 'Composite', + className: 'Dimension', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + internalName: { + required: false, + serializedName: 'internalName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Dimension; diff --git a/lib/services/networkManagement2/lib/lib/models/dnsNameAvailabilityResult.js b/lib/services/networkManagement2/lib/lib/models/dnsNameAvailabilityResult.js new file mode 100644 index 0000000000..4e6553cf7c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/dnsNameAvailabilityResult.js @@ -0,0 +1,52 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the CheckDnsNameAvailability API service call. + * + */ +class DnsNameAvailabilityResult { + /** + * Create a DnsNameAvailabilityResult. + * @member {boolean} [available] Domain availability (True/False). + */ + constructor() { + } + + /** + * Defines the metadata of DnsNameAvailabilityResult + * + * @returns {object} metadata of DnsNameAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'DnsNameAvailabilityResult', + type: { + name: 'Composite', + className: 'DnsNameAvailabilityResult', + modelProperties: { + available: { + required: false, + serializedName: 'available', + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = DnsNameAvailabilityResult; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroup.js b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroup.js new file mode 100644 index 0000000000..67708def1f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroup.js @@ -0,0 +1,111 @@ +/* + * 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'); + +/** + * Effective network security group. + * + */ +class EffectiveNetworkSecurityGroup { + /** + * Create a EffectiveNetworkSecurityGroup. + * @member {object} [networkSecurityGroup] The ID of network security group + * that is applied. + * @member {string} [networkSecurityGroup.id] Resource ID. + * @member {object} [association] Associated resources. + * @member {object} [association.subnet] The ID of the subnet if assigned. + * @member {string} [association.subnet.id] Resource ID. + * @member {object} [association.networkInterface] The ID of the network + * interface if assigned. + * @member {string} [association.networkInterface.id] Resource ID. + * @member {array} [effectiveSecurityRules] A collection of effective + * security rules. + * @member {object} [tagMap] Mapping of tags to list of IP Addresses included + * within the tag. + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveNetworkSecurityGroup + * + * @returns {object} metadata of EffectiveNetworkSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveNetworkSecurityGroup', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityGroup', + modelProperties: { + networkSecurityGroup: { + required: false, + serializedName: 'networkSecurityGroup', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + association: { + required: false, + serializedName: 'association', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityGroupAssociation' + } + }, + effectiveSecurityRules: { + required: false, + serializedName: 'effectiveSecurityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EffectiveNetworkSecurityRuleElementType', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityRule' + } + } + } + }, + tagMap: { + required: false, + serializedName: 'tagMap', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'ArrayElementType', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + } + } + }; + } +} + +module.exports = EffectiveNetworkSecurityGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupAssociation.js b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupAssociation.js new file mode 100644 index 0000000000..cf0fce59e3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupAssociation.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'; + +const models = require('./index'); + +/** + * The effective network security group association. + * + */ +class EffectiveNetworkSecurityGroupAssociation { + /** + * Create a EffectiveNetworkSecurityGroupAssociation. + * @member {object} [subnet] The ID of the subnet if assigned. + * @member {string} [subnet.id] Resource ID. + * @member {object} [networkInterface] The ID of the network interface if + * assigned. + * @member {string} [networkInterface.id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveNetworkSecurityGroupAssociation + * + * @returns {object} metadata of EffectiveNetworkSecurityGroupAssociation + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveNetworkSecurityGroupAssociation', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityGroupAssociation', + modelProperties: { + subnet: { + required: false, + serializedName: 'subnet', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + networkInterface: { + required: false, + serializedName: 'networkInterface', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + } + }; + } +} + +module.exports = EffectiveNetworkSecurityGroupAssociation; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupListResult.js b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupListResult.js new file mode 100644 index 0000000000..08511ae7c1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityGroupListResult.js @@ -0,0 +1,71 @@ +/* + * 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'); + +/** + * Response for list effective network security groups API service call. + * + */ +class EffectiveNetworkSecurityGroupListResult { + /** + * Create a EffectiveNetworkSecurityGroupListResult. + * @member {array} [value] A list of effective network security groups. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveNetworkSecurityGroupListResult + * + * @returns {object} metadata of EffectiveNetworkSecurityGroupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveNetworkSecurityGroupListResult', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityGroupListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EffectiveNetworkSecurityGroupElementType', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityGroup' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EffectiveNetworkSecurityGroupListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityRule.js b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityRule.js new file mode 100644 index 0000000000..736aa984d6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveNetworkSecurityRule.js @@ -0,0 +1,225 @@ +/* + * 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'; + +/** + * Effective network security rules. + * + */ +class EffectiveNetworkSecurityRule { + /** + * Create a EffectiveNetworkSecurityRule. + * @member {string} [name] The name of the security rule specified by the + * user (if created by the user). + * @member {string} [protocol] The network protocol this rule applies to. + * Possible values are: 'Tcp', 'Udp', and 'All'. Possible values include: + * 'Tcp', 'Udp', 'All' + * @member {string} [sourcePortRange] The source port or range. + * @member {string} [destinationPortRange] The destination port or range. + * @member {array} [sourcePortRanges] The source port ranges. Expected values + * include a single integer between 0 and 65535, a range using '-' as + * seperator (e.g. 100-400), or an asterix (*) + * @member {array} [destinationPortRanges] The destination port ranges. + * Expected values include a single integer between 0 and 65535, a range + * using '-' as seperator (e.g. 100-400), or an asterix (*) + * @member {string} [sourceAddressPrefix] The source address prefix. + * @member {string} [destinationAddressPrefix] The destination address + * prefix. + * @member {array} [sourceAddressPrefixes] The source address prefixes. + * Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, + * AureLoadBalancer, Internet), System Tags, and the asterix (*). + * @member {array} [destinationAddressPrefixes] The destination address + * prefixes. Expected values include CIDR IP ranges, Default Tags + * (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix + * (*). + * @member {array} [expandedSourceAddressPrefix] The expanded source address + * prefix. + * @member {array} [expandedDestinationAddressPrefix] Expanded destination + * address prefix. + * @member {string} [access] Whether network traffic is allowed or denied. + * Possible values are: 'Allow' and 'Deny'. Possible values include: 'Allow', + * 'Deny' + * @member {number} [priority] The priority of the rule. + * @member {string} [direction] The direction of the rule. Possible values + * are: 'Inbound and Outbound'. Possible values include: 'Inbound', + * 'Outbound' + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveNetworkSecurityRule + * + * @returns {object} metadata of EffectiveNetworkSecurityRule + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveNetworkSecurityRule', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityRule', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + protocol: { + required: false, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + sourcePortRange: { + required: false, + serializedName: 'sourcePortRange', + type: { + name: 'String' + } + }, + destinationPortRange: { + required: false, + serializedName: 'destinationPortRange', + type: { + name: 'String' + } + }, + sourcePortRanges: { + required: false, + serializedName: 'sourcePortRanges', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + destinationPortRanges: { + required: false, + serializedName: 'destinationPortRanges', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sourceAddressPrefix: { + required: false, + serializedName: 'sourceAddressPrefix', + type: { + name: 'String' + } + }, + destinationAddressPrefix: { + required: false, + serializedName: 'destinationAddressPrefix', + type: { + name: 'String' + } + }, + sourceAddressPrefixes: { + required: false, + serializedName: 'sourceAddressPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + destinationAddressPrefixes: { + required: false, + serializedName: 'destinationAddressPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + expandedSourceAddressPrefix: { + required: false, + serializedName: 'expandedSourceAddressPrefix', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + expandedDestinationAddressPrefix: { + required: false, + serializedName: 'expandedDestinationAddressPrefix', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + access: { + required: false, + serializedName: 'access', + type: { + name: 'String' + } + }, + priority: { + required: false, + serializedName: 'priority', + type: { + name: 'Number' + } + }, + direction: { + required: false, + serializedName: 'direction', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EffectiveNetworkSecurityRule; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveRoute.js b/lib/services/networkManagement2/lib/lib/models/effectiveRoute.js new file mode 100644 index 0000000000..88fde6a540 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveRoute.js @@ -0,0 +1,116 @@ +/* + * 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'; + +/** + * Effective Route + * + */ +class EffectiveRoute { + /** + * Create a EffectiveRoute. + * @member {string} [name] The name of the user defined route. This is + * optional. + * @member {string} [source] Who created the route. Possible values are: + * 'Unknown', 'User', 'VirtualNetworkGateway', and 'Default'. Possible values + * include: 'Unknown', 'User', 'VirtualNetworkGateway', 'Default' + * @member {string} [state] The value of effective route. Possible values + * are: 'Active' and 'Invalid'. Possible values include: 'Active', 'Invalid' + * @member {array} [addressPrefix] The address prefixes of the effective + * routes in CIDR notation. + * @member {array} [nextHopIpAddress] The IP address of the next hop of the + * effective route. + * @member {string} [nextHopType] The type of Azure hop the packet should be + * sent to. Possible values are: 'VirtualNetworkGateway', 'VnetLocal', + * 'Internet', 'VirtualAppliance', and 'None'. Possible values include: + * 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', + * 'None' + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveRoute + * + * @returns {object} metadata of EffectiveRoute + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveRoute', + type: { + name: 'Composite', + className: 'EffectiveRoute', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + source: { + required: false, + serializedName: 'source', + type: { + name: 'String' + } + }, + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + }, + addressPrefix: { + required: false, + serializedName: 'addressPrefix', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + nextHopIpAddress: { + required: false, + serializedName: 'nextHopIpAddress', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + nextHopType: { + required: false, + serializedName: 'nextHopType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EffectiveRoute; diff --git a/lib/services/networkManagement2/lib/lib/models/effectiveRouteListResult.js b/lib/services/networkManagement2/lib/lib/models/effectiveRouteListResult.js new file mode 100644 index 0000000000..a28ac9989d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/effectiveRouteListResult.js @@ -0,0 +1,71 @@ +/* + * 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'); + +/** + * Response for list effective route API service call. + * + */ +class EffectiveRouteListResult { + /** + * Create a EffectiveRouteListResult. + * @member {array} [value] A list of effective routes. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of EffectiveRouteListResult + * + * @returns {object} metadata of EffectiveRouteListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EffectiveRouteListResult', + type: { + name: 'Composite', + className: 'EffectiveRouteListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EffectiveRouteElementType', + type: { + name: 'Composite', + className: 'EffectiveRoute' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EffectiveRouteListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/endpointServiceResult.js b/lib/services/networkManagement2/lib/lib/models/endpointServiceResult.js new file mode 100644 index 0000000000..eb6b4da846 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/endpointServiceResult.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'); + +/** + * Endpoint service. + * + * @extends models['SubResource'] + */ +class EndpointServiceResult extends models['SubResource'] { + /** + * Create a EndpointServiceResult. + * @member {string} [name] Name of the endpoint service. + * @member {string} [type] Type of the endpoint service. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EndpointServiceResult + * + * @returns {object} metadata of EndpointServiceResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EndpointServiceResult', + type: { + name: 'Composite', + className: 'EndpointServiceResult', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EndpointServiceResult; diff --git a/lib/services/networkManagement2/lib/lib/models/endpointServicesListResult.js b/lib/services/networkManagement2/lib/lib/models/endpointServicesListResult.js new file mode 100644 index 0000000000..4817adf490 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/endpointServicesListResult.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'; + +/** + * Response for the ListAvailableEndpointServices API service call. + */ +class EndpointServicesListResult extends Array { + /** + * Create a EndpointServicesListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of EndpointServicesListResult + * + * @returns {object} metadata of EndpointServicesListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'EndpointServicesListResult', + type: { + name: 'Composite', + className: 'EndpointServicesListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EndpointServiceResultElementType', + type: { + name: 'Composite', + className: 'EndpointServiceResult' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = EndpointServicesListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/errorDetails.js b/lib/services/networkManagement2/lib/lib/models/errorDetails.js new file mode 100644 index 0000000000..fcac88503a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/errorDetails.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'; + +/** + * Class representing a ErrorDetails. + */ +class ErrorDetails { + /** + * Create a ErrorDetails. + * @member {string} [code] + * @member {string} [target] + * @member {string} [message] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorDetails + * + * @returns {object} metadata of ErrorDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'ErrorDetails', + type: { + name: 'Composite', + className: 'ErrorDetails', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorDetails; diff --git a/lib/services/networkManagement2/lib/lib/models/errorModel.js b/lib/services/networkManagement2/lib/lib/models/errorModel.js new file mode 100644 index 0000000000..67d76db59f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/errorModel.js @@ -0,0 +1,93 @@ +/* + * 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'); + +/** + * Class representing a ErrorModel. + */ +class ErrorModel { + /** + * Create a ErrorModel. + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {array} [details] + * @member {string} [innerError] + */ + constructor() { + } + + /** + * Defines the metadata of ErrorModel + * + * @returns {object} metadata of ErrorModel + * + */ + mapper() { + return { + required: false, + serializedName: 'Error', + type: { + name: 'Composite', + className: 'ErrorModel', + modelProperties: { + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + message: { + required: false, + serializedName: 'message', + type: { + name: 'String' + } + }, + target: { + required: false, + serializedName: 'target', + type: { + name: 'String' + } + }, + details: { + required: false, + serializedName: 'details', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ErrorDetailsElementType', + type: { + name: 'Composite', + className: 'ErrorDetails' + } + } + } + }, + innerError: { + required: false, + serializedName: 'innerError', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ErrorModel; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuit.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuit.js new file mode 100644 index 0000000000..f80a5f3555 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuit.js @@ -0,0 +1,228 @@ +/* + * 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'); + +/** + * ExpressRouteCircuit resource + * + * @extends models['Resource'] + */ +class ExpressRouteCircuit extends models['Resource'] { + /** + * Create a ExpressRouteCircuit. + * @member {object} [sku] The SKU. + * @member {string} [sku.name] The name of the SKU. + * @member {string} [sku.tier] The tier of the SKU. Possible values are + * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * @member {string} [sku.family] The family of the SKU. Possible values are: + * 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * @member {boolean} [allowClassicOperations] Allow classic operations + * @member {string} [circuitProvisioningState] The CircuitProvisioningState + * state of the resource. + * @member {string} [serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values + * are 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * @member {array} [authorizations] The list of authorizations. + * @member {array} [peerings] The list of peerings. + * @member {string} [serviceKey] The ServiceKey. + * @member {string} [serviceProviderNotes] The ServiceProviderNotes. + * @member {object} [serviceProviderProperties] The + * ServiceProviderProperties. + * @member {string} [serviceProviderProperties.serviceProviderName] The + * serviceProviderName. + * @member {string} [serviceProviderProperties.peeringLocation] The peering + * location. + * @member {number} [serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuit + * + * @returns {object} metadata of ExpressRouteCircuit + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuit', + type: { + name: 'Composite', + className: 'ExpressRouteCircuit', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitSku' + } + }, + allowClassicOperations: { + required: false, + serializedName: 'properties.allowClassicOperations', + type: { + name: 'Boolean' + } + }, + circuitProvisioningState: { + required: false, + serializedName: 'properties.circuitProvisioningState', + type: { + name: 'String' + } + }, + serviceProviderProvisioningState: { + required: false, + serializedName: 'properties.serviceProviderProvisioningState', + type: { + name: 'String' + } + }, + authorizations: { + required: false, + serializedName: 'properties.authorizations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitAuthorizationElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitAuthorization' + } + } + } + }, + peerings: { + required: false, + serializedName: 'properties.peerings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeering' + } + } + } + }, + serviceKey: { + required: false, + serializedName: 'properties.serviceKey', + type: { + name: 'String' + } + }, + serviceProviderNotes: { + required: false, + serializedName: 'properties.serviceProviderNotes', + type: { + name: 'String' + } + }, + serviceProviderProperties: { + required: false, + serializedName: 'properties.serviceProviderProperties', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitServiceProviderProperties' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + gatewayManagerEtag: { + required: false, + serializedName: 'properties.gatewayManagerEtag', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuit; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitArpTable.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitArpTable.js new file mode 100644 index 0000000000..5eb3544870 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitArpTable.js @@ -0,0 +1,76 @@ +/* + * 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'; + +/** + * The ARP table associated with the ExpressRouteCircuit. + * + */ +class ExpressRouteCircuitArpTable { + /** + * Create a ExpressRouteCircuitArpTable. + * @member {number} [age] Age + * @member {string} [interfaceProperty] Interface + * @member {string} [ipAddress] The IP address. + * @member {string} [macAddress] The MAC address. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitArpTable + * + * @returns {object} metadata of ExpressRouteCircuitArpTable + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitArpTable', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitArpTable', + modelProperties: { + age: { + required: false, + serializedName: 'age', + type: { + name: 'Number' + } + }, + interfaceProperty: { + required: false, + serializedName: 'interface', + type: { + name: 'String' + } + }, + ipAddress: { + required: false, + serializedName: 'ipAddress', + type: { + name: 'String' + } + }, + macAddress: { + required: false, + serializedName: 'macAddress', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitArpTable; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitAuthorization.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitAuthorization.js new file mode 100644 index 0000000000..84385110c0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitAuthorization.js @@ -0,0 +1,102 @@ +/* + * 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'); + +/** + * Authorization in an ExpressRouteCircuit resource. + * + * @extends models['SubResource'] + */ +class ExpressRouteCircuitAuthorization extends models['SubResource'] { + /** + * Create a ExpressRouteCircuitAuthorization. + * @member {string} [authorizationKey] The authorization key. + * @member {string} [authorizationUseStatus] AuthorizationUseStatus. Possible + * values are: 'Available' and 'InUse'. Possible values include: 'Available', + * 'InUse' + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuitAuthorization + * + * @returns {object} metadata of ExpressRouteCircuitAuthorization + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitAuthorization', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitAuthorization', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + authorizationKey: { + required: false, + serializedName: 'properties.authorizationKey', + type: { + name: 'String' + } + }, + authorizationUseStatus: { + required: false, + serializedName: 'properties.authorizationUseStatus', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitAuthorization; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitConnection.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitConnection.js new file mode 100644 index 0000000000..053141896d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitConnection.js @@ -0,0 +1,135 @@ +/* + * 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'); + +/** + * Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + * + * @extends models['SubResource'] + */ +class ExpressRouteCircuitConnection extends models['SubResource'] { + /** + * Create a ExpressRouteCircuitConnection. + * @member {object} [expressRouteCircuitPeering] Reference to Express Route + * Circuit Private Peering Resource of the circuit initiating connection. + * @member {string} [expressRouteCircuitPeering.id] Resource ID. + * @member {object} [peerExpressRouteCircuitPeering] Reference to Express + * Route Circuit Private Peering Resource of the peered circuit. + * @member {string} [peerExpressRouteCircuitPeering.id] Resource ID. + * @member {string} [addressPrefix] /29 IP address space to carve out + * Customer addresses for tunnels. + * @member {string} [authorizationKey] The authorization key. + * @member {string} [circuitConnectionStatus] Express Route Circuit + * Connection State. Possible values are: 'Connected' and 'Disconnected'. + * Possible values include: 'Connected', 'Connecting', 'Disconnected' + * @member {string} [provisioningState] Provisioning state of the circuit + * connection resource. Possible values are: 'Succeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuitConnection + * + * @returns {object} metadata of ExpressRouteCircuitConnection + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitConnection', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitConnection', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + expressRouteCircuitPeering: { + required: false, + serializedName: 'properties.expressRouteCircuitPeering', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + peerExpressRouteCircuitPeering: { + required: false, + serializedName: 'properties.peerExpressRouteCircuitPeering', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + addressPrefix: { + required: false, + serializedName: 'properties.addressPrefix', + type: { + name: 'String' + } + }, + authorizationKey: { + required: false, + serializedName: 'properties.authorizationKey', + type: { + name: 'String' + } + }, + circuitConnectionStatus: { + required: false, + readOnly: true, + serializedName: 'properties.circuitConnectionStatus', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitConnection; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitListResult.js new file mode 100644 index 0000000000..bc5717df8d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitListResult.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'; + +/** + * Response for ListExpressRouteCircuit API service call. + */ +class ExpressRouteCircuitListResult extends Array { + /** + * Create a ExpressRouteCircuitListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuitListResult + * + * @returns {object} metadata of ExpressRouteCircuitListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuit' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeering.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeering.js new file mode 100644 index 0000000000..d965a8eb65 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeering.js @@ -0,0 +1,309 @@ +/* + * 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'); + +/** + * Peering in an ExpressRouteCircuit resource. + * + * @extends models['SubResource'] + */ +class ExpressRouteCircuitPeering extends models['SubResource'] { + /** + * Create a ExpressRouteCircuitPeering. + * @member {string} [peeringType] The peering type. Possible values include: + * 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + * @member {string} [state] The peering state. Possible values include: + * 'Disabled', 'Enabled' + * @member {number} [azureASN] The Azure ASN. + * @member {number} [peerASN] The peer ASN. + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address + * prefix. + * @member {string} [primaryAzurePort] The primary port. + * @member {string} [secondaryAzurePort] The secondary port. + * @member {string} [sharedKey] The shared key. + * @member {number} [vlanId] The VLAN ID. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of + * the peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of + * the peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [stats] Gets peering stats. + * @member {number} [stats.primarybytesIn] Gets BytesIn of the peering. + * @member {number} [stats.primarybytesOut] Gets BytesOut of the peering. + * @member {number} [stats.secondarybytesIn] Gets BytesIn of the peering. + * @member {number} [stats.secondarybytesOut] Gets BytesOut of the peering. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [lastModifiedBy] Gets whether the provider or the + * customer last modified the peering. + * @member {object} [routeFilter] The reference of the RouteFilter resource. + * @member {array} [routeFilter.rules] Collection of RouteFilterRules + * contained within a route filter. + * @member {array} [routeFilter.peerings] A collection of references to + * express route circuit peerings. + * @member {string} [routeFilter.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [routeFilter.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {object} [ipv6PeeringConfig] The IPv6 peering configuration. + * @member {string} [ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * @member {string} [ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * @member {object} [ipv6PeeringConfig.microsoftPeeringConfig] The Microsoft + * peering configuration. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.customerASN] + * The CustomerASN of the peering. + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [ipv6PeeringConfig.routeFilter] The reference of the + * RouteFilter resource. + * @member {array} [ipv6PeeringConfig.routeFilter.rules] Collection of + * RouteFilterRules contained within a route filter. + * @member {array} [ipv6PeeringConfig.routeFilter.peerings] A collection of + * references to express route circuit peerings. + * @member {string} [ipv6PeeringConfig.routeFilter.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [ipv6PeeringConfig.routeFilter.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {string} [ipv6PeeringConfig.state] The state of peering. Possible + * values are: 'Disabled' and 'Enabled'. Possible values include: 'Disabled', + * 'Enabled' + * @member {array} [connections] The list of circuit connections associated + * with Azure Private Peering for this circuit. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuitPeering + * + * @returns {object} metadata of ExpressRouteCircuitPeering + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitPeering', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeering', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + peeringType: { + required: false, + serializedName: 'properties.peeringType', + type: { + name: 'String' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + azureASN: { + required: false, + serializedName: 'properties.azureASN', + type: { + name: 'Number' + } + }, + peerASN: { + required: false, + serializedName: 'properties.peerASN', + constraints: { + InclusiveMaximum: 4294967295, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + primaryPeerAddressPrefix: { + required: false, + serializedName: 'properties.primaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + secondaryPeerAddressPrefix: { + required: false, + serializedName: 'properties.secondaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + primaryAzurePort: { + required: false, + serializedName: 'properties.primaryAzurePort', + type: { + name: 'String' + } + }, + secondaryAzurePort: { + required: false, + serializedName: 'properties.secondaryAzurePort', + type: { + name: 'String' + } + }, + sharedKey: { + required: false, + serializedName: 'properties.sharedKey', + type: { + name: 'String' + } + }, + vlanId: { + required: false, + serializedName: 'properties.vlanId', + type: { + name: 'Number' + } + }, + microsoftPeeringConfig: { + required: false, + serializedName: 'properties.microsoftPeeringConfig', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeeringConfig' + } + }, + stats: { + required: false, + serializedName: 'properties.stats', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitStats' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + gatewayManagerEtag: { + required: false, + serializedName: 'properties.gatewayManagerEtag', + type: { + name: 'String' + } + }, + lastModifiedBy: { + required: false, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + }, + routeFilter: { + required: false, + serializedName: 'properties.routeFilter', + type: { + name: 'Composite', + className: 'RouteFilter' + } + }, + ipv6PeeringConfig: { + required: false, + serializedName: 'properties.ipv6PeeringConfig', + type: { + name: 'Composite', + className: 'Ipv6ExpressRouteCircuitPeeringConfig' + } + }, + connections: { + required: false, + serializedName: 'properties.connections', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitConnectionElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitConnection' + } + } + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitPeering; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringConfig.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringConfig.js new file mode 100644 index 0000000000..79a97c813e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringConfig.js @@ -0,0 +1,113 @@ +/* + * 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'; + +/** + * Specifies the peering configuration. + * + */ +class ExpressRouteCircuitPeeringConfig { + /** + * Create a ExpressRouteCircuitPeeringConfig. + * @member {array} [advertisedPublicPrefixes] The reference of + * AdvertisedPublicPrefixes. + * @member {array} [advertisedCommunities] The communities of bgp peering. + * Spepcified for microsoft peering + * @member {string} [advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [legacyMode] The legacy mode of the peering. + * @member {number} [customerASN] The CustomerASN of the peering. + * @member {string} [routingRegistryName] The RoutingRegistryName of the + * configuration. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitPeeringConfig + * + * @returns {object} metadata of ExpressRouteCircuitPeeringConfig + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitPeeringConfig', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeeringConfig', + modelProperties: { + advertisedPublicPrefixes: { + required: false, + serializedName: 'advertisedPublicPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + advertisedCommunities: { + required: false, + serializedName: 'advertisedCommunities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + advertisedPublicPrefixesState: { + required: false, + serializedName: 'advertisedPublicPrefixesState', + type: { + name: 'String' + } + }, + legacyMode: { + required: false, + serializedName: 'legacyMode', + type: { + name: 'Number' + } + }, + customerASN: { + required: false, + serializedName: 'customerASN', + type: { + name: 'Number' + } + }, + routingRegistryName: { + required: false, + serializedName: 'routingRegistryName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitPeeringConfig; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringListResult.js new file mode 100644 index 0000000000..c8c233ee5e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitPeeringListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListPeering API service call retrieves all peerings that belong + * to an ExpressRouteCircuit. + */ +class ExpressRouteCircuitPeeringListResult extends Array { + /** + * Create a ExpressRouteCircuitPeeringListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCircuitPeeringListResult + * + * @returns {object} metadata of ExpressRouteCircuitPeeringListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitPeeringListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeeringListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeering' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitPeeringListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitReference.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitReference.js new file mode 100644 index 0000000000..d7c4e7081c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitReference.js @@ -0,0 +1,51 @@ +/* + * 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'; + +/** + * Class representing a ExpressRouteCircuitReference. + */ +class ExpressRouteCircuitReference { + /** + * Create a ExpressRouteCircuitReference. + * @member {string} [id] Corresponding Express Route Circuit Id. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitReference + * + * @returns {object} metadata of ExpressRouteCircuitReference + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitReference', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitReference', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitReference; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTable.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTable.js new file mode 100644 index 0000000000..d3a4e5f351 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTable.js @@ -0,0 +1,84 @@ +/* + * 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'; + +/** + * The routes table associated with the ExpressRouteCircuit + * + */ +class ExpressRouteCircuitRoutesTable { + /** + * Create a ExpressRouteCircuitRoutesTable. + * @member {string} [network] network + * @member {string} [nextHop] nextHop + * @member {string} [locPrf] locPrf + * @member {number} [weight] weight. + * @member {string} [path] path + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitRoutesTable + * + * @returns {object} metadata of ExpressRouteCircuitRoutesTable + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitRoutesTable', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitRoutesTable', + modelProperties: { + network: { + required: false, + serializedName: 'network', + type: { + name: 'String' + } + }, + nextHop: { + required: false, + serializedName: 'nextHop', + type: { + name: 'String' + } + }, + locPrf: { + required: false, + serializedName: 'locPrf', + type: { + name: 'String' + } + }, + weight: { + required: false, + serializedName: 'weight', + type: { + name: 'Number' + } + }, + path: { + required: false, + serializedName: 'path', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitRoutesTable; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTableSummary.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTableSummary.js new file mode 100644 index 0000000000..9faca22420 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitRoutesTableSummary.js @@ -0,0 +1,87 @@ +/* + * 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'; + +/** + * The routes table associated with the ExpressRouteCircuit. + * + */ +class ExpressRouteCircuitRoutesTableSummary { + /** + * Create a ExpressRouteCircuitRoutesTableSummary. + * @member {string} [neighbor] Neighbor + * @member {number} [v] BGP version number spoken to the neighbor. + * @member {number} [as] Autonomous system number. + * @member {string} [upDown] The length of time that the BGP session has been + * in the Established state, or the current status if not in the Established + * state. + * @member {string} [statePfxRcd] Current state of the BGP session, and the + * number of prefixes that have been received from a neighbor or peer group. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitRoutesTableSummary + * + * @returns {object} metadata of ExpressRouteCircuitRoutesTableSummary + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitRoutesTableSummary', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitRoutesTableSummary', + modelProperties: { + neighbor: { + required: false, + serializedName: 'neighbor', + type: { + name: 'String' + } + }, + v: { + required: false, + serializedName: 'v', + type: { + name: 'Number' + } + }, + as: { + required: false, + serializedName: 'as', + type: { + name: 'Number' + } + }, + upDown: { + required: false, + serializedName: 'upDown', + type: { + name: 'String' + } + }, + statePfxRcd: { + required: false, + serializedName: 'statePfxRcd', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitRoutesTableSummary; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitServiceProviderProperties.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitServiceProviderProperties.js new file mode 100644 index 0000000000..66a96d4d72 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitServiceProviderProperties.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Contains ServiceProviderProperties in an ExpressRouteCircuit. + * + */ +class ExpressRouteCircuitServiceProviderProperties { + /** + * Create a ExpressRouteCircuitServiceProviderProperties. + * @member {string} [serviceProviderName] The serviceProviderName. + * @member {string} [peeringLocation] The peering location. + * @member {number} [bandwidthInMbps] The BandwidthInMbps. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitServiceProviderProperties + * + * @returns {object} metadata of ExpressRouteCircuitServiceProviderProperties + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitServiceProviderProperties', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitServiceProviderProperties', + modelProperties: { + serviceProviderName: { + required: false, + serializedName: 'serviceProviderName', + type: { + name: 'String' + } + }, + peeringLocation: { + required: false, + serializedName: 'peeringLocation', + type: { + name: 'String' + } + }, + bandwidthInMbps: { + required: false, + serializedName: 'bandwidthInMbps', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitServiceProviderProperties; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitSku.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitSku.js new file mode 100644 index 0000000000..3fc69adc76 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitSku.js @@ -0,0 +1,71 @@ +/* + * 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'; + +/** + * Contains SKU in an ExpressRouteCircuit. + * + */ +class ExpressRouteCircuitSku { + /** + * Create a ExpressRouteCircuitSku. + * @member {string} [name] The name of the SKU. + * @member {string} [tier] The tier of the SKU. Possible values are + * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * @member {string} [family] The family of the SKU. Possible values are: + * 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitSku + * + * @returns {object} metadata of ExpressRouteCircuitSku + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitSku', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitSku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + }, + family: { + required: false, + serializedName: 'family', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitSku; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitStats.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitStats.js new file mode 100644 index 0000000000..f2eda96ec4 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitStats.js @@ -0,0 +1,76 @@ +/* + * 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'; + +/** + * Contains stats associated with the peering. + * + */ +class ExpressRouteCircuitStats { + /** + * Create a ExpressRouteCircuitStats. + * @member {number} [primarybytesIn] Gets BytesIn of the peering. + * @member {number} [primarybytesOut] Gets BytesOut of the peering. + * @member {number} [secondarybytesIn] Gets BytesIn of the peering. + * @member {number} [secondarybytesOut] Gets BytesOut of the peering. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitStats + * + * @returns {object} metadata of ExpressRouteCircuitStats + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitStats', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitStats', + modelProperties: { + primarybytesIn: { + required: false, + serializedName: 'primarybytesIn', + type: { + name: 'Number' + } + }, + primarybytesOut: { + required: false, + serializedName: 'primarybytesOut', + type: { + name: 'Number' + } + }, + secondarybytesIn: { + required: false, + serializedName: 'secondarybytesIn', + type: { + name: 'Number' + } + }, + secondarybytesOut: { + required: false, + serializedName: 'secondarybytesOut', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitStats; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsArpTableListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsArpTableListResult.js new file mode 100644 index 0000000000..8a4e983b53 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsArpTableListResult.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'); + +/** + * Response for ListArpTable associated with the Express Route Circuits API. + * + */ +class ExpressRouteCircuitsArpTableListResult { + /** + * Create a ExpressRouteCircuitsArpTableListResult. + * @member {array} [value] Gets list of the ARP table. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitsArpTableListResult + * + * @returns {object} metadata of ExpressRouteCircuitsArpTableListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitsArpTableListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitsArpTableListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitArpTableElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitArpTable' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitsArpTableListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableListResult.js new file mode 100644 index 0000000000..5615578ab3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableListResult.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'); + +/** + * Response for ListRoutesTable associated with the Express Route Circuits API. + * + */ +class ExpressRouteCircuitsRoutesTableListResult { + /** + * Create a ExpressRouteCircuitsRoutesTableListResult. + * @member {array} [value] The list of routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitsRoutesTableListResult + * + * @returns {object} metadata of ExpressRouteCircuitsRoutesTableListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitsRoutesTableListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitsRoutesTableListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitRoutesTableElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitRoutesTable' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitsRoutesTableListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableSummaryListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableSummaryListResult.js new file mode 100644 index 0000000000..2f19980efc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCircuitsRoutesTableSummaryListResult.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'); + +/** + * Response for ListRoutesTable associated with the Express Route Circuits API. + * + */ +class ExpressRouteCircuitsRoutesTableSummaryListResult { + /** + * Create a ExpressRouteCircuitsRoutesTableSummaryListResult. + * @member {array} [value] A list of the routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCircuitsRoutesTableSummaryListResult + * + * @returns {object} metadata of ExpressRouteCircuitsRoutesTableSummaryListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCircuitsRoutesTableSummaryListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitsRoutesTableSummaryListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitRoutesTableSummaryElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitRoutesTableSummary' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCircuitsRoutesTableSummaryListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnection.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnection.js new file mode 100644 index 0000000000..21e3b6f300 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnection.js @@ -0,0 +1,207 @@ +/* + * 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'); + +/** + * ExpressRouteCrossConnection resource + * + * @extends models['Resource'] + */ +class ExpressRouteCrossConnection extends models['Resource'] { + /** + * Create a ExpressRouteCrossConnection. + * @member {string} [primaryAzurePort] The name of the primary port. + * @member {string} [secondaryAzurePort] The name of the secondary port. + * @member {number} [sTag] The identifier of the circuit traffic. + * @member {string} [peeringLocation] The peering location of the + * ExpressRoute circuit. + * @member {number} [bandwidthInMbps] The circuit bandwidth In Mbps. + * @member {object} [expressRouteCircuit] The ExpressRouteCircuit + * @member {string} [expressRouteCircuit.id] Corresponding Express Route + * Circuit Id. + * @member {string} [serviceProviderProvisioningState] The provisioning state + * of the circuit in the connectivity provider system. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned'. Possible values include: + * 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' + * @member {string} [serviceProviderNotes] Additional read only notes set by + * the connectivity provider. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {array} [peerings] The list of peerings. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCrossConnection + * + * @returns {object} metadata of ExpressRouteCrossConnection + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnection', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnection', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + primaryAzurePort: { + required: false, + readOnly: true, + serializedName: 'properties.primaryAzurePort', + type: { + name: 'String' + } + }, + secondaryAzurePort: { + required: false, + readOnly: true, + serializedName: 'properties.secondaryAzurePort', + type: { + name: 'String' + } + }, + sTag: { + required: false, + readOnly: true, + serializedName: 'properties.sTag', + type: { + name: 'Number' + } + }, + peeringLocation: { + required: false, + readOnly: true, + serializedName: 'properties.peeringLocation', + type: { + name: 'String' + } + }, + bandwidthInMbps: { + required: false, + readOnly: true, + serializedName: 'properties.bandwidthInMbps', + type: { + name: 'Number' + } + }, + expressRouteCircuit: { + required: false, + readOnly: true, + serializedName: 'properties.expressRouteCircuit', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitReference' + } + }, + serviceProviderProvisioningState: { + required: false, + serializedName: 'properties.serviceProviderProvisioningState', + type: { + name: 'String' + } + }, + serviceProviderNotes: { + required: false, + serializedName: 'properties.serviceProviderNotes', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + peerings: { + required: false, + serializedName: 'properties.peerings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCrossConnectionPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionPeering' + } + } + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnection; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionListResult.js new file mode 100644 index 0000000000..b96c2712da --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListExpressRouteCrossConnection API service call. + */ +class ExpressRouteCrossConnectionListResult extends Array { + /** + * Create a ExpressRouteCrossConnectionListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCrossConnectionListResult + * + * @returns {object} metadata of ExpressRouteCrossConnectionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnectionListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCrossConnectionElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnection' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnectionListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeering.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeering.js new file mode 100644 index 0000000000..31abfbf098 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeering.js @@ -0,0 +1,266 @@ +/* + * 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'); + +/** + * Peering in an ExpressRoute Cross Connection resource. + * + * @extends models['SubResource'] + */ +class ExpressRouteCrossConnectionPeering extends models['SubResource'] { + /** + * Create a ExpressRouteCrossConnectionPeering. + * @member {string} [peeringType] The peering type. Possible values include: + * 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + * @member {string} [state] The peering state. Possible values include: + * 'Disabled', 'Enabled' + * @member {number} [azureASN] The Azure ASN. + * @member {number} [peerASN] The peer ASN. + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address + * prefix. + * @member {string} [primaryAzurePort] The primary port. + * @member {string} [secondaryAzurePort] The secondary port. + * @member {string} [sharedKey] The shared key. + * @member {number} [vlanId] The VLAN ID. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of + * the peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of + * the peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [lastModifiedBy] Gets whether the provider or the + * customer last modified the peering. + * @member {object} [ipv6PeeringConfig] The IPv6 peering configuration. + * @member {string} [ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * @member {string} [ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * @member {object} [ipv6PeeringConfig.microsoftPeeringConfig] The Microsoft + * peering configuration. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.customerASN] + * The CustomerASN of the peering. + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [ipv6PeeringConfig.routeFilter] The reference of the + * RouteFilter resource. + * @member {array} [ipv6PeeringConfig.routeFilter.rules] Collection of + * RouteFilterRules contained within a route filter. + * @member {array} [ipv6PeeringConfig.routeFilter.peerings] A collection of + * references to express route circuit peerings. + * @member {string} [ipv6PeeringConfig.routeFilter.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [ipv6PeeringConfig.routeFilter.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {string} [ipv6PeeringConfig.state] The state of peering. Possible + * values are: 'Disabled' and 'Enabled'. Possible values include: 'Disabled', + * 'Enabled' + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCrossConnectionPeering + * + * @returns {object} metadata of ExpressRouteCrossConnectionPeering + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnectionPeering', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionPeering', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + peeringType: { + required: false, + serializedName: 'properties.peeringType', + type: { + name: 'String' + } + }, + state: { + required: false, + serializedName: 'properties.state', + type: { + name: 'String' + } + }, + azureASN: { + required: false, + readOnly: true, + serializedName: 'properties.azureASN', + type: { + name: 'Number' + } + }, + peerASN: { + required: false, + serializedName: 'properties.peerASN', + constraints: { + InclusiveMaximum: 4294967295, + InclusiveMinimum: 1 + }, + type: { + name: 'Number' + } + }, + primaryPeerAddressPrefix: { + required: false, + serializedName: 'properties.primaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + secondaryPeerAddressPrefix: { + required: false, + serializedName: 'properties.secondaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + primaryAzurePort: { + required: false, + readOnly: true, + serializedName: 'properties.primaryAzurePort', + type: { + name: 'String' + } + }, + secondaryAzurePort: { + required: false, + readOnly: true, + serializedName: 'properties.secondaryAzurePort', + type: { + name: 'String' + } + }, + sharedKey: { + required: false, + serializedName: 'properties.sharedKey', + type: { + name: 'String' + } + }, + vlanId: { + required: false, + serializedName: 'properties.vlanId', + type: { + name: 'Number' + } + }, + microsoftPeeringConfig: { + required: false, + serializedName: 'properties.microsoftPeeringConfig', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeeringConfig' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + gatewayManagerEtag: { + required: false, + readOnly: true, + serializedName: 'properties.gatewayManagerEtag', + type: { + name: 'String' + } + }, + lastModifiedBy: { + required: false, + serializedName: 'properties.lastModifiedBy', + type: { + name: 'String' + } + }, + ipv6PeeringConfig: { + required: false, + serializedName: 'properties.ipv6PeeringConfig', + type: { + name: 'Composite', + className: 'Ipv6ExpressRouteCircuitPeeringConfig' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnectionPeering; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeeringList.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeeringList.js new file mode 100644 index 0000000000..5f35071118 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionPeeringList.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListPeering API service call retrieves all peerings that belong + * to an ExpressRouteCrossConnection. + */ +class ExpressRouteCrossConnectionPeeringList extends Array { + /** + * Create a ExpressRouteCrossConnectionPeeringList. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteCrossConnectionPeeringList + * + * @returns {object} metadata of ExpressRouteCrossConnectionPeeringList + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnectionPeeringList', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionPeeringList', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCrossConnectionPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionPeering' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnectionPeeringList; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionRoutesTableSummary.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionRoutesTableSummary.js new file mode 100644 index 0000000000..20f7e76770 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionRoutesTableSummary.js @@ -0,0 +1,80 @@ +/* + * 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'; + +/** + * The routes table associated with the ExpressRouteCircuit. + * + */ +class ExpressRouteCrossConnectionRoutesTableSummary { + /** + * Create a ExpressRouteCrossConnectionRoutesTableSummary. + * @member {string} [neighbor] IP address of Neighbor router + * @member {number} [asn] Autonomous system number. + * @member {string} [upDown] The length of time that the BGP session has been + * in the Established state, or the current status if not in the Established + * state. + * @member {string} [stateOrPrefixesReceived] Current state of the BGP + * session, and the number of prefixes that have been received from a + * neighbor or peer group. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCrossConnectionRoutesTableSummary + * + * @returns {object} metadata of ExpressRouteCrossConnectionRoutesTableSummary + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnectionRoutesTableSummary', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionRoutesTableSummary', + modelProperties: { + neighbor: { + required: false, + serializedName: 'neighbor', + type: { + name: 'String' + } + }, + asn: { + required: false, + serializedName: 'asn', + type: { + name: 'Number' + } + }, + upDown: { + required: false, + serializedName: 'upDown', + type: { + name: 'String' + } + }, + stateOrPrefixesReceived: { + required: false, + serializedName: 'stateOrPrefixesReceived', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnectionRoutesTableSummary; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionsRoutesTableSummaryListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionsRoutesTableSummaryListResult.js new file mode 100644 index 0000000000..cb01c31a22 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteCrossConnectionsRoutesTableSummaryListResult.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Response for ListRoutesTable associated with the Express Route Cross + * Connections. + * + */ +class ExpressRouteCrossConnectionsRoutesTableSummaryListResult { + /** + * Create a ExpressRouteCrossConnectionsRoutesTableSummaryListResult. + * @member {array} [value] A list of the routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteCrossConnectionsRoutesTableSummaryListResult + * + * @returns {object} metadata of ExpressRouteCrossConnectionsRoutesTableSummaryListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteCrossConnectionsRoutesTableSummaryListResult', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionsRoutesTableSummaryListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCrossConnectionRoutesTableSummaryElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCrossConnectionRoutesTableSummary' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteCrossConnectionsRoutesTableSummaryListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProvider.js b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProvider.js new file mode 100644 index 0000000000..43bb5d2474 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProvider.js @@ -0,0 +1,132 @@ +/* + * 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'); + +/** + * A ExpressRouteResourceProvider object. + * + * @extends models['Resource'] + */ +class ExpressRouteServiceProvider extends models['Resource'] { + /** + * Create a ExpressRouteServiceProvider. + * @member {array} [peeringLocations] Get a list of peering locations. + * @member {array} [bandwidthsOffered] Gets bandwidths offered. + * @member {string} [provisioningState] Gets the provisioning state of the + * resource. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteServiceProvider + * + * @returns {object} metadata of ExpressRouteServiceProvider + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteServiceProvider', + type: { + name: 'Composite', + className: 'ExpressRouteServiceProvider', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + peeringLocations: { + required: false, + serializedName: 'properties.peeringLocations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + bandwidthsOffered: { + required: false, + serializedName: 'properties.bandwidthsOffered', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteServiceProviderBandwidthsOfferedElementType', + type: { + name: 'Composite', + className: 'ExpressRouteServiceProviderBandwidthsOffered' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteServiceProvider; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderBandwidthsOffered.js b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderBandwidthsOffered.js new file mode 100644 index 0000000000..5cdb44d2c0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderBandwidthsOffered.js @@ -0,0 +1,60 @@ +/* + * 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'; + +/** + * Contains bandwidths offered in ExpressRouteServiceProvider resources. + * + */ +class ExpressRouteServiceProviderBandwidthsOffered { + /** + * Create a ExpressRouteServiceProviderBandwidthsOffered. + * @member {string} [offerName] The OfferName. + * @member {number} [valueInMbps] The ValueInMbps. + */ + constructor() { + } + + /** + * Defines the metadata of ExpressRouteServiceProviderBandwidthsOffered + * + * @returns {object} metadata of ExpressRouteServiceProviderBandwidthsOffered + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteServiceProviderBandwidthsOffered', + type: { + name: 'Composite', + className: 'ExpressRouteServiceProviderBandwidthsOffered', + modelProperties: { + offerName: { + required: false, + serializedName: 'offerName', + type: { + name: 'String' + } + }, + valueInMbps: { + required: false, + serializedName: 'valueInMbps', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteServiceProviderBandwidthsOffered; diff --git a/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderListResult.js b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderListResult.js new file mode 100644 index 0000000000..cf04035185 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/expressRouteServiceProviderListResult.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'; + +/** + * Response for the ListExpressRouteServiceProvider API service call. + */ +class ExpressRouteServiceProviderListResult extends Array { + /** + * Create a ExpressRouteServiceProviderListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ExpressRouteServiceProviderListResult + * + * @returns {object} metadata of ExpressRouteServiceProviderListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'ExpressRouteServiceProviderListResult', + type: { + name: 'Composite', + className: 'ExpressRouteServiceProviderListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteServiceProviderElementType', + type: { + name: 'Composite', + className: 'ExpressRouteServiceProvider' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ExpressRouteServiceProviderListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/flowLogInformation.js b/lib/services/networkManagement2/lib/lib/models/flowLogInformation.js new file mode 100644 index 0000000000..9efb176e4e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/flowLogInformation.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'); + +/** + * Information on the configuration of flow log. + * + */ +class FlowLogInformation { + /** + * Create a FlowLogInformation. + * @member {string} targetResourceId The ID of the resource to configure for + * flow logging. + * @member {string} storageId ID of the storage account which is used to + * store the flow log. + * @member {boolean} enabled Flag to enable/disable flow logging. + * @member {object} [retentionPolicy] + * @member {number} [retentionPolicy.days] Number of days to retain flow log + * records. + * @member {boolean} [retentionPolicy.enabled] Flag to enable/disable + * retention. + */ + constructor() { + } + + /** + * Defines the metadata of FlowLogInformation + * + * @returns {object} metadata of FlowLogInformation + * + */ + mapper() { + return { + required: false, + serializedName: 'FlowLogInformation', + type: { + name: 'Composite', + className: 'FlowLogInformation', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + }, + storageId: { + required: true, + serializedName: 'properties.storageId', + type: { + name: 'String' + } + }, + enabled: { + required: true, + serializedName: 'properties.enabled', + type: { + name: 'Boolean' + } + }, + retentionPolicy: { + required: false, + serializedName: 'properties.retentionPolicy', + type: { + name: 'Composite', + className: 'RetentionPolicyParameters' + } + } + } + } + }; + } +} + +module.exports = FlowLogInformation; diff --git a/lib/services/networkManagement2/lib/lib/models/flowLogStatusParameters.js b/lib/services/networkManagement2/lib/lib/models/flowLogStatusParameters.js new file mode 100644 index 0000000000..0f9221918d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/flowLogStatusParameters.js @@ -0,0 +1,53 @@ +/* + * 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 that define a resource to query flow log status. + * + */ +class FlowLogStatusParameters { + /** + * Create a FlowLogStatusParameters. + * @member {string} targetResourceId The target resource where getting the + * flow logging status. + */ + constructor() { + } + + /** + * Defines the metadata of FlowLogStatusParameters + * + * @returns {object} metadata of FlowLogStatusParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'FlowLogStatusParameters', + type: { + name: 'Composite', + className: 'FlowLogStatusParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = FlowLogStatusParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/frontendIPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/frontendIPConfiguration.js new file mode 100644 index 0000000000..561dccc025 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/frontendIPConfiguration.js @@ -0,0 +1,374 @@ +/* + * 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'); + +/** + * Frontend IP address of the load balancer. + * + * @extends models['SubResource'] + */ +class FrontendIPConfiguration extends models['SubResource'] { + /** + * Create a FrontendIPConfiguration. + * @member {array} [inboundNatRules] Read only. Inbound rules URIs that use + * this frontend IP. + * @member {array} [inboundNatPools] Read only. Inbound pools URIs that use + * this frontend IP. + * @member {array} [outboundNatRules] Read only. Outbound rules URIs that use + * this frontend IP. + * @member {array} [loadBalancingRules] Gets load balancing rules URIs that + * use this frontend IP. + * @member {string} [privateIPAddress] The private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] The Private IP allocation + * method. Possible values are: 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to + * the network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {object} [publicIPAddress] The reference of the Public IP + * resource. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address + * SKU. Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} + * [publicIPAddress.ipConfiguration.privateIPAllocationMethod] The private IP + * allocation method. Possible values are 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {object} [publicIPAddress.ipConfiguration.subnet] The reference of + * the subnet resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.addressPrefix] + * The address prefix for the subnet. + * @member {object} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.routeTable.subnets] A collection + * of references to subnets. + * @member {boolean} + * [publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} [publicIPAddress.ipConfiguration.subnet.serviceEndpoints] + * An array of service endpoints. + * @member {array} [publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations + * using subnet. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} [publicIPAddress.ipConfiguration.provisioningState] Gets + * the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [publicIPAddress.ipConfiguration.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or + * sets the Domain name label.The concatenation of the domain name label and + * the regionalized DNS zone make up the fully qualified domain name + * associated with the public IP address. If a domain name label is + * specified, an A DNS record is created for the public IP in the Microsoft + * Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets + * the Reverse FQDN. A user-visible, fully qualified domain name that + * resolves to this public IP address. If the reverseFqdn is specified, then + * a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated + * with the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout + * of the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning + * state of the PublicIP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {array} [zones] A list of availability zones denoting the IP + * allocated for the resource needs to come from. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of FrontendIPConfiguration + * + * @returns {object} metadata of FrontendIPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'FrontendIPConfiguration', + type: { + name: 'Composite', + className: 'FrontendIPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + inboundNatRules: { + required: false, + readOnly: true, + serializedName: 'properties.inboundNatRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + inboundNatPools: { + required: false, + readOnly: true, + serializedName: 'properties.inboundNatPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + outboundNatRules: { + required: false, + readOnly: true, + serializedName: 'properties.outboundNatRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + loadBalancingRules: { + required: false, + readOnly: true, + serializedName: 'properties.loadBalancingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + privateIPAddress: { + required: false, + serializedName: 'properties.privateIPAddress', + type: { + name: 'String' + } + }, + privateIPAllocationMethod: { + required: false, + serializedName: 'properties.privateIPAllocationMethod', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'Subnet' + } + }, + publicIPAddress: { + required: false, + serializedName: 'properties.publicIPAddress', + type: { + name: 'Composite', + className: 'PublicIPAddress' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + zones: { + required: false, + serializedName: 'zones', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = FrontendIPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/gatewayRoute.js b/lib/services/networkManagement2/lib/lib/models/gatewayRoute.js new file mode 100644 index 0000000000..4f2a9526a6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/gatewayRoute.js @@ -0,0 +1,107 @@ +/* + * 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'; + +/** + * Gateway routing details + * + */ +class GatewayRoute { + /** + * Create a GatewayRoute. + * @member {string} [localAddress] The gateway's local address + * @member {string} [network] The route's network prefix + * @member {string} [nextHop] The route's next hop + * @member {string} [sourcePeer] The peer this route was learned from + * @member {string} [origin] The source this route was learned from + * @member {string} [asPath] The route's AS path sequence + * @member {number} [weight] The route's weight + */ + constructor() { + } + + /** + * Defines the metadata of GatewayRoute + * + * @returns {object} metadata of GatewayRoute + * + */ + mapper() { + return { + required: false, + serializedName: 'GatewayRoute', + type: { + name: 'Composite', + className: 'GatewayRoute', + modelProperties: { + localAddress: { + required: false, + readOnly: true, + serializedName: 'localAddress', + type: { + name: 'String' + } + }, + network: { + required: false, + readOnly: true, + serializedName: 'network', + type: { + name: 'String' + } + }, + nextHop: { + required: false, + readOnly: true, + serializedName: 'nextHop', + type: { + name: 'String' + } + }, + sourcePeer: { + required: false, + readOnly: true, + serializedName: 'sourcePeer', + type: { + name: 'String' + } + }, + origin: { + required: false, + readOnly: true, + serializedName: 'origin', + type: { + name: 'String' + } + }, + asPath: { + required: false, + readOnly: true, + serializedName: 'asPath', + type: { + name: 'String' + } + }, + weight: { + required: false, + readOnly: true, + serializedName: 'weight', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = GatewayRoute; diff --git a/lib/services/networkManagement2/lib/lib/models/gatewayRouteListResult.js b/lib/services/networkManagement2/lib/lib/models/gatewayRouteListResult.js new file mode 100644 index 0000000000..55cecfba96 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/gatewayRouteListResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * List of virtual network gateway routes + * + */ +class GatewayRouteListResult { + /** + * Create a GatewayRouteListResult. + * @member {array} [value] List of gateway routes + */ + constructor() { + } + + /** + * Defines the metadata of GatewayRouteListResult + * + * @returns {object} metadata of GatewayRouteListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'GatewayRouteListResult', + type: { + name: 'Composite', + className: 'GatewayRouteListResult', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'GatewayRouteElementType', + type: { + name: 'Composite', + className: 'GatewayRoute' + } + } + } + } + } + } + }; + } +} + +module.exports = GatewayRouteListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/iPAddressAvailabilityResult.js b/lib/services/networkManagement2/lib/lib/models/iPAddressAvailabilityResult.js new file mode 100644 index 0000000000..ceedaeb386 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/iPAddressAvailabilityResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for CheckIPAddressAvailability API service call + * + */ +class IPAddressAvailabilityResult { + /** + * Create a IPAddressAvailabilityResult. + * @member {boolean} [available] Private IP address availability. + * @member {array} [availableIPAddresses] Contains other available private IP + * addresses if the asked for address is taken. + */ + constructor() { + } + + /** + * Defines the metadata of IPAddressAvailabilityResult + * + * @returns {object} metadata of IPAddressAvailabilityResult + * + */ + mapper() { + return { + required: false, + serializedName: 'IPAddressAvailabilityResult', + type: { + name: 'Composite', + className: 'IPAddressAvailabilityResult', + modelProperties: { + available: { + required: false, + serializedName: 'available', + type: { + name: 'Boolean' + } + }, + availableIPAddresses: { + required: false, + serializedName: 'availableIPAddresses', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = IPAddressAvailabilityResult; diff --git a/lib/services/networkManagement2/lib/lib/models/iPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/iPConfiguration.js new file mode 100644 index 0000000000..dbdb4959c8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/iPConfiguration.js @@ -0,0 +1,207 @@ +/* + * 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'); + +/** + * IP configuration + * + * @extends models['SubResource'] + */ +class IPConfiguration extends models['SubResource'] { + /** + * Create a IPConfiguration. + * @member {string} [privateIPAddress] The private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] The private IP allocation + * method. Possible values are 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to + * the network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {object} [publicIPAddress] The reference of the public IP + * resource. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address + * SKU. Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or + * sets the Domain name label.The concatenation of the domain name label and + * the regionalized DNS zone make up the fully qualified domain name + * associated with the public IP address. If a domain name label is + * specified, an A DNS record is created for the public IP in the Microsoft + * Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets + * the Reverse FQDN. A user-visible, fully qualified domain name that + * resolves to this public IP address. If the reverseFqdn is specified, then + * a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated + * with the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout + * of the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning + * state of the PublicIP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of IPConfiguration + * + * @returns {object} metadata of IPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'IPConfiguration', + type: { + name: 'Composite', + className: 'IPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + privateIPAddress: { + required: false, + serializedName: 'properties.privateIPAddress', + type: { + name: 'String' + } + }, + privateIPAllocationMethod: { + required: false, + serializedName: 'properties.privateIPAllocationMethod', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'Subnet' + } + }, + publicIPAddress: { + required: false, + serializedName: 'properties.publicIPAddress', + type: { + name: 'Composite', + className: 'PublicIPAddress' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/inboundNatPool.js b/lib/services/networkManagement2/lib/lib/models/inboundNatPool.js new file mode 100644 index 0000000000..b8304b9e92 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/inboundNatPool.js @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Inbound NAT pool of the load balancer. + * + * @extends models['SubResource'] + */ +class InboundNatPool extends models['SubResource'] { + /** + * Create a InboundNatPool. + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {string} protocol Possible values include: 'Udp', 'Tcp', 'All' + * @member {number} frontendPortRangeStart The first port number in the range + * of external ports that will be used to provide Inbound Nat to NICs + * associated with a load balancer. Acceptable values range between 1 and + * 65534. + * @member {number} frontendPortRangeEnd The last port number in the range of + * external ports that will be used to provide Inbound Nat to NICs associated + * with a load balancer. Acceptable values range between 1 and 65535. + * @member {number} backendPort The port used for internal connections on the + * endpoint. Acceptable values are between 1 and 65535. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default + * value is 4 minutes. This element is only used when the protocol is set to + * TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's + * endpoint for the floating IP capability required to configure a SQL + * AlwaysOn Availability Group. This setting is required when using the SQL + * AlwaysOn Availability Groups in SQL server. This setting can't be changed + * after you create the endpoint. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of InboundNatPool + * + * @returns {object} metadata of InboundNatPool + * + */ + mapper() { + return { + required: false, + serializedName: 'InboundNatPool', + type: { + name: 'Composite', + className: 'InboundNatPool', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + frontendIPConfiguration: { + required: false, + serializedName: 'properties.frontendIPConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + protocol: { + required: true, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + frontendPortRangeStart: { + required: true, + serializedName: 'properties.frontendPortRangeStart', + type: { + name: 'Number' + } + }, + frontendPortRangeEnd: { + required: true, + serializedName: 'properties.frontendPortRangeEnd', + type: { + name: 'Number' + } + }, + backendPort: { + required: true, + serializedName: 'properties.backendPort', + type: { + name: 'Number' + } + }, + idleTimeoutInMinutes: { + required: false, + serializedName: 'properties.idleTimeoutInMinutes', + type: { + name: 'Number' + } + }, + enableFloatingIP: { + required: false, + serializedName: 'properties.enableFloatingIP', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = InboundNatPool; diff --git a/lib/services/networkManagement2/lib/lib/models/inboundNatRule.js b/lib/services/networkManagement2/lib/lib/models/inboundNatRule.js new file mode 100644 index 0000000000..09299a448c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/inboundNatRule.js @@ -0,0 +1,389 @@ +/* + * 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'); + +/** + * Inbound NAT rule of the load balancer. + * + * @extends models['SubResource'] + */ +class InboundNatRule extends models['SubResource'] { + /** + * Create a InboundNatRule. + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [backendIPConfiguration] A reference to a private IP + * address defined on a network interface of a VM. Traffic sent to the + * frontend port of each of the frontend IP configurations is forwarded to + * the backend IP. + * @member {array} + * [backendIPConfiguration.applicationGatewayBackendAddressPools] The + * reference of ApplicationGatewayBackendAddressPool resource. + * @member {array} [backendIPConfiguration.loadBalancerBackendAddressPools] + * The reference of LoadBalancerBackendAddressPool resource. + * @member {array} [backendIPConfiguration.loadBalancerInboundNatRules] A + * list of references of LoadBalancerInboundNatRules. + * @member {string} [backendIPConfiguration.privateIPAddress] Private IP + * address of the IP configuration. + * @member {string} [backendIPConfiguration.privateIPAllocationMethod] + * Defines how a private IP address is assigned. Possible values are: + * 'Static' and 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {string} [backendIPConfiguration.privateIPAddressVersion] + * Available from Api-Version 2016-03-30 onwards, it represents whether the + * specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. + * Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + * 'IPv6' + * @member {object} [backendIPConfiguration.subnet] Subnet bound to the IP + * configuration. + * @member {string} [backendIPConfiguration.subnet.addressPrefix] The address + * prefix for the subnet. + * @member {object} [backendIPConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.subnets] A collection + * of references to subnets. + * @member {string} + * [backendIPConfiguration.subnet.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * @member {string} + * [backendIPConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.subnet.networkSecurityGroup.etag] + * A unique read-only string that changes whenever the resource is updated. + * @member {object} [backendIPConfiguration.subnet.routeTable] The reference + * of the RouteTable resource. + * @member {array} [backendIPConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} [backendIPConfiguration.subnet.routeTable.subnets] A + * collection of references to subnets. + * @member {boolean} + * [backendIPConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets + * or sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} + * [backendIPConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.subnet.routeTable.etag] Gets a + * unique read-only string that changes whenever the resource is updated. + * @member {array} [backendIPConfiguration.subnet.serviceEndpoints] An array + * of service endpoints. + * @member {array} [backendIPConfiguration.subnet.ipConfigurations] Gets an + * array of references to the network interface IP configurations using + * subnet. + * @member {array} [backendIPConfiguration.subnet.resourceNavigationLinks] + * Gets an array of references to the external resources using subnet. + * @member {string} [backendIPConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [backendIPConfiguration.subnet.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [backendIPConfiguration.subnet.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {boolean} [backendIPConfiguration.primary] Gets whether this is a + * primary customer address on the network interface. + * @member {object} [backendIPConfiguration.publicIPAddress] Public IP + * address bound to the IP configuration. + * @member {object} [backendIPConfiguration.publicIPAddress.sku] The public + * IP address SKU. + * @member {string} [backendIPConfiguration.publicIPAddress.sku.name] Name of + * a public IP address SKU. Possible values include: 'Basic', 'Standard' + * @member {string} + * [backendIPConfiguration.publicIPAddress.publicIPAllocationMethod] The + * public IP allocation method. Possible values are: 'Static' and 'Dynamic'. + * Possible values include: 'Static', 'Dynamic' + * @member {string} + * [backendIPConfiguration.publicIPAddress.publicIPAddressVersion] The public + * IP address version. Possible values are: 'IPv4' and 'IPv6'. Possible + * values include: 'IPv4', 'IPv6' + * @member {object} [backendIPConfiguration.publicIPAddress.ipConfiguration] + * The IP configuration associated with the public IP address. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.privateIPAddress] + * The private IP address of the IP configuration. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet] The + * reference of the subnet resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.addressPrefix] + * The address prefix for the subnet. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] + * The reference of the NetworkSecurityGroup resource. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] + * A collection of references to subnets. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] + * A unique read-only string that changes whenever the resource is updated. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable] + * The reference of the RouteTable resource. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] + * The provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.serviceEndpoints] + * An array of service endpoints. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations + * using subnet. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] + * Gets an array of references to the external resources using subnet. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.name] The + * name of the resource that is unique within a resource group. This name can + * be used to access the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.publicIPAddress] + * The reference of the public IP resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.provisioningState] + * Gets the provisioning state of the public IP resource. Possible values + * are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [backendIPConfiguration.publicIPAddress.dnsSettings] The + * FQDN of the DNS record associated with the public IP address. + * @member {string} + * [backendIPConfiguration.publicIPAddress.dnsSettings.domainNameLabel] Gets + * or sets the Domain name label.The concatenation of the domain name label + * and the regionalized DNS zone make up the fully qualified domain name + * associated with the public IP address. If a domain name label is + * specified, an A DNS record is created for the public IP in the Microsoft + * Azure DNS system. + * @member {string} [backendIPConfiguration.publicIPAddress.dnsSettings.fqdn] + * Gets the FQDN, Fully qualified domain name of the A DNS record associated + * with the public IP. This is the concatenation of the domainNameLabel and + * the regionalized DNS zone. + * @member {string} + * [backendIPConfiguration.publicIPAddress.dnsSettings.reverseFqdn] Gets or + * Sets the Reverse FQDN. A user-visible, fully qualified domain name that + * resolves to this public IP address. If the reverseFqdn is specified, then + * a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [backendIPConfiguration.publicIPAddress.ipTags] The list + * of tags associated with the public IP address. + * @member {string} [backendIPConfiguration.publicIPAddress.ipAddress] The IP + * address associated with the public IP address resource. + * @member {number} + * [backendIPConfiguration.publicIPAddress.idleTimeoutInMinutes] The idle + * timeout of the public IP address. + * @member {string} [backendIPConfiguration.publicIPAddress.resourceGuid] The + * resource GUID property of the public IP resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.provisioningState] The + * provisioning state of the PublicIP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.publicIPAddress.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {array} [backendIPConfiguration.publicIPAddress.zones] A list of + * availability zones denoting the IP allocated for the resource needs to + * come from. + * @member {array} [backendIPConfiguration.applicationSecurityGroups] + * Application security groups in which the IP configuration is included. + * @member {string} [backendIPConfiguration.provisioningState] The + * provisioning state of the network interface IP configuration. Possible + * values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.name] The name of the resource + * that is unique within a resource group. This name can be used to access + * the resource. + * @member {string} [backendIPConfiguration.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {string} [protocol] Possible values include: 'Udp', 'Tcp', 'All' + * @member {number} [frontendPort] The port for the external endpoint. Port + * numbers for each rule must be unique within the Load Balancer. Acceptable + * values range from 1 to 65534. + * @member {number} [backendPort] The port used for the internal endpoint. + * Acceptable values range from 1 to 65535. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default + * value is 4 minutes. This element is only used when the protocol is set to + * TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's + * endpoint for the floating IP capability required to configure a SQL + * AlwaysOn Availability Group. This setting is required when using the SQL + * AlwaysOn Availability Groups in SQL server. This setting can't be changed + * after you create the endpoint. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of InboundNatRule + * + * @returns {object} metadata of InboundNatRule + * + */ + mapper() { + return { + required: false, + serializedName: 'InboundNatRule', + type: { + name: 'Composite', + className: 'InboundNatRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + frontendIPConfiguration: { + required: false, + serializedName: 'properties.frontendIPConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + backendIPConfiguration: { + required: false, + readOnly: true, + serializedName: 'properties.backendIPConfiguration', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + }, + protocol: { + required: false, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + frontendPort: { + required: false, + serializedName: 'properties.frontendPort', + type: { + name: 'Number' + } + }, + backendPort: { + required: false, + serializedName: 'properties.backendPort', + type: { + name: 'Number' + } + }, + idleTimeoutInMinutes: { + required: false, + serializedName: 'properties.idleTimeoutInMinutes', + type: { + name: 'Number' + } + }, + enableFloatingIP: { + required: false, + serializedName: 'properties.enableFloatingIP', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = InboundNatRule; diff --git a/lib/services/networkManagement2/lib/lib/models/inboundNatRuleListResult.js b/lib/services/networkManagement2/lib/lib/models/inboundNatRuleListResult.js new file mode 100644 index 0000000000..6bc8468b6d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/inboundNatRuleListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListInboundNatRule API service call. + */ +class InboundNatRuleListResult extends Array { + /** + * Create a InboundNatRuleListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of InboundNatRuleListResult + * + * @returns {object} metadata of InboundNatRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'InboundNatRuleListResult', + type: { + name: 'Composite', + className: 'InboundNatRuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InboundNatRuleElementType', + type: { + name: 'Composite', + className: 'InboundNatRule' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = InboundNatRuleListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/index.d.ts b/lib/services/networkManagement2/lib/lib/models/index.d.ts new file mode 100644 index 0000000000..57f6af7873 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/index.d.ts @@ -0,0 +1,6789 @@ +/* + * 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. + */ + +import { BaseResource } from 'ms-rest-azure'; +import { CloudError } from 'ms-rest-azure'; +import * as moment from 'moment'; + +export { BaseResource } from 'ms-rest-azure'; +export { CloudError } from 'ms-rest-azure'; + + +/** + * @class + * Initializes a new instance of the SubResource class. + * @constructor + * Reference to another subresource. + * + * @member {string} [id] Resource ID. + */ +export interface SubResource extends BaseResource { + id?: string; +} + +/** + * @class + * Initializes a new instance of the BackendAddressPool class. + * @constructor + * Pool of backend IP addresses. + * + * @member {array} [backendIPConfigurations] Gets collection of references to + * IP addresses defined in network interfaces. + * @member {array} [loadBalancingRules] Gets load balancing rules that use this + * backend address pool. + * @member {object} [outboundNatRule] Gets outbound rules that use this backend + * address pool. + * @member {string} [outboundNatRule.id] Resource ID. + * @member {string} [provisioningState] Get provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface BackendAddressPool extends SubResource { + readonly backendIPConfigurations?: NetworkInterfaceIPConfiguration[]; + readonly loadBalancingRules?: SubResource[]; + readonly outboundNatRule?: SubResource; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the InboundNatRule class. + * @constructor + * Inbound NAT rule of the load balancer. + * + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [backendIPConfiguration] A reference to a private IP + * address defined on a network interface of a VM. Traffic sent to the frontend + * port of each of the frontend IP configurations is forwarded to the backend + * IP. + * @member {array} + * [backendIPConfiguration.applicationGatewayBackendAddressPools] The reference + * of ApplicationGatewayBackendAddressPool resource. + * @member {array} [backendIPConfiguration.loadBalancerBackendAddressPools] The + * reference of LoadBalancerBackendAddressPool resource. + * @member {array} [backendIPConfiguration.loadBalancerInboundNatRules] A list + * of references of LoadBalancerInboundNatRules. + * @member {string} [backendIPConfiguration.privateIPAddress] Private IP + * address of the IP configuration. + * @member {string} [backendIPConfiguration.privateIPAllocationMethod] Defines + * how a private IP address is assigned. Possible values are: 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {string} [backendIPConfiguration.privateIPAddressVersion] Available + * from Api-Version 2016-03-30 onwards, it represents whether the specific + * ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + * are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + * @member {object} [backendIPConfiguration.subnet] Subnet bound to the IP + * configuration. + * @member {string} [backendIPConfiguration.subnet.addressPrefix] The address + * prefix for the subnet. + * @member {object} [backendIPConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [backendIPConfiguration.subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [backendIPConfiguration.subnet.networkSecurityGroup.subnets] + * A collection of references to subnets. + * @member {string} + * [backendIPConfiguration.subnet.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * @member {string} + * [backendIPConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.subnet.networkSecurityGroup.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [backendIPConfiguration.subnet.routeTable] The reference of + * the RouteTable resource. + * @member {array} [backendIPConfiguration.subnet.routeTable.routes] Collection + * of routes contained within a route table. + * @member {array} [backendIPConfiguration.subnet.routeTable.subnets] A + * collection of references to subnets. + * @member {boolean} + * [backendIPConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets + * or sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} + * [backendIPConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.subnet.routeTable.etag] Gets a + * unique read-only string that changes whenever the resource is updated. + * @member {array} [backendIPConfiguration.subnet.serviceEndpoints] An array of + * service endpoints. + * @member {array} [backendIPConfiguration.subnet.ipConfigurations] Gets an + * array of references to the network interface IP configurations using subnet. + * @member {array} [backendIPConfiguration.subnet.resourceNavigationLinks] Gets + * an array of references to the external resources using subnet. + * @member {string} [backendIPConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [backendIPConfiguration.subnet.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [backendIPConfiguration.subnet.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {boolean} [backendIPConfiguration.primary] Gets whether this is a + * primary customer address on the network interface. + * @member {object} [backendIPConfiguration.publicIPAddress] Public IP address + * bound to the IP configuration. + * @member {object} [backendIPConfiguration.publicIPAddress.sku] The public IP + * address SKU. + * @member {string} [backendIPConfiguration.publicIPAddress.sku.name] Name of a + * public IP address SKU. Possible values include: 'Basic', 'Standard' + * @member {string} + * [backendIPConfiguration.publicIPAddress.publicIPAllocationMethod] The public + * IP allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} + * [backendIPConfiguration.publicIPAddress.publicIPAddressVersion] The public + * IP address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [backendIPConfiguration.publicIPAddress.ipConfiguration] + * The IP configuration associated with the public IP address. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.privateIPAddress] + * The private IP address of the IP configuration. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet] The + * reference of the subnet resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.addressPrefix] + * The address prefix for the subnet. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] + * The reference of the NetworkSecurityGroup resource. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] + * A collection of references to subnets. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] + * A unique read-only string that changes whenever the resource is updated. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable] + * The reference of the RouteTable resource. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] + * The provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.serviceEndpoints] + * An array of service endpoints. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations using + * subnet. + * @member {array} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] + * Gets an array of references to the external resources using subnet. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.name] The + * name of the resource that is unique within a resource group. This name can + * be used to access the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.subnet.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.provisioningState] + * Gets the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} + * [backendIPConfiguration.publicIPAddress.ipConfiguration.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [backendIPConfiguration.publicIPAddress.dnsSettings] The + * FQDN of the DNS record associated with the public IP address. + * @member {string} + * [backendIPConfiguration.publicIPAddress.dnsSettings.domainNameLabel] Gets or + * sets the Domain name label.The concatenation of the domain name label and + * the regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [backendIPConfiguration.publicIPAddress.dnsSettings.fqdn] + * Gets the FQDN, Fully qualified domain name of the A DNS record associated + * with the public IP. This is the concatenation of the domainNameLabel and the + * regionalized DNS zone. + * @member {string} + * [backendIPConfiguration.publicIPAddress.dnsSettings.reverseFqdn] Gets or + * Sets the Reverse FQDN. A user-visible, fully qualified domain name that + * resolves to this public IP address. If the reverseFqdn is specified, then a + * PTR DNS record is created pointing from the IP address in the in-addr.arpa + * domain to the reverse FQDN. + * @member {array} [backendIPConfiguration.publicIPAddress.ipTags] The list of + * tags associated with the public IP address. + * @member {string} [backendIPConfiguration.publicIPAddress.ipAddress] The IP + * address associated with the public IP address resource. + * @member {number} + * [backendIPConfiguration.publicIPAddress.idleTimeoutInMinutes] The idle + * timeout of the public IP address. + * @member {string} [backendIPConfiguration.publicIPAddress.resourceGuid] The + * resource GUID property of the public IP resource. + * @member {string} [backendIPConfiguration.publicIPAddress.provisioningState] + * The provisioning state of the PublicIP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.publicIPAddress.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {array} [backendIPConfiguration.publicIPAddress.zones] A list of + * availability zones denoting the IP allocated for the resource needs to come + * from. + * @member {array} [backendIPConfiguration.applicationSecurityGroups] + * Application security groups in which the IP configuration is included. + * @member {string} [backendIPConfiguration.provisioningState] The provisioning + * state of the network interface IP configuration. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [backendIPConfiguration.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * @member {string} [backendIPConfiguration.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {string} [protocol] Possible values include: 'Udp', 'Tcp', 'All' + * @member {number} [frontendPort] The port for the external endpoint. Port + * numbers for each rule must be unique within the Load Balancer. Acceptable + * values range from 1 to 65534. + * @member {number} [backendPort] The port used for the internal endpoint. + * Acceptable values range from 1 to 65535. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default value + * is 4 minutes. This element is only used when the protocol is set to TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's endpoint + * for the floating IP capability required to configure a SQL AlwaysOn + * Availability Group. This setting is required when using the SQL AlwaysOn + * Availability Groups in SQL server. This setting can't be changed after you + * create the endpoint. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface InboundNatRule extends SubResource { + frontendIPConfiguration?: SubResource; + readonly backendIPConfiguration?: NetworkInterfaceIPConfiguration; + protocol?: string; + frontendPort?: number; + backendPort?: number; + idleTimeoutInMinutes?: number; + enableFloatingIP?: boolean; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the Resource class. + * @constructor + * Common resource representation. + * + * @member {string} [id] Resource ID. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [location] Resource location. + * @member {object} [tags] Resource tags. + */ +export interface Resource extends BaseResource { + id?: string; + readonly name?: string; + readonly type?: string; + location?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the ApplicationSecurityGroup class. + * @constructor + * An application security group in a resource group. + * + * @member {string} [resourceGuid] The resource GUID property of the + * application security group resource. It uniquely identifies a resource, even + * if the user changes its name or migrate the resource across subscriptions or + * resource groups. + * @member {string} [provisioningState] The provisioning state of the + * application security group resource. Possible values are: 'Succeeded', + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ApplicationSecurityGroup extends Resource { + readonly resourceGuid?: string; + readonly provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the SecurityRule class. + * @constructor + * Network security rule. + * + * @member {string} [description] A description for this rule. Restricted to + * 140 chars. + * @member {string} protocol Network protocol this rule applies to. Possible + * values are 'Tcp', 'Udp', and '*'. Possible values include: 'Tcp', 'Udp', '*' + * @member {string} [sourcePortRange] The source port or range. Integer or + * range between 0 and 65535. Asterix '*' can also be used to match all ports. + * @member {string} [destinationPortRange] The destination port or range. + * Integer or range between 0 and 65535. Asterix '*' can also be used to match + * all ports. + * @member {string} [sourceAddressPrefix] The CIDR or source IP range. Asterix + * '*' can also be used to match all source IPs. Default tags such as + * 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If + * this is an ingress rule, specifies where network traffic originates from. + * @member {array} [sourceAddressPrefixes] The CIDR or source IP ranges. + * @member {array} [sourceApplicationSecurityGroups] The application security + * group specified as source. + * @member {string} [destinationAddressPrefix] The destination address prefix. + * CIDR or destination IP range. Asterix '*' can also be used to match all + * source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and + * 'Internet' can also be used. + * @member {array} [destinationAddressPrefixes] The destination address + * prefixes. CIDR or destination IP ranges. + * @member {array} [destinationApplicationSecurityGroups] The application + * security group specified as destination. + * @member {array} [sourcePortRanges] The source port ranges. + * @member {array} [destinationPortRanges] The destination port ranges. + * @member {string} access The network traffic is allowed or denied. Possible + * values are: 'Allow' and 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {number} [priority] The priority of the rule. The value can be + * between 100 and 4096. The priority number must be unique for each rule in + * the collection. The lower the priority number, the higher the priority of + * the rule. + * @member {string} direction The direction of the rule. The direction + * specifies if rule will be evaluated on incoming or outcoming traffic. + * Possible values are: 'Inbound' and 'Outbound'. Possible values include: + * 'Inbound', 'Outbound' + * @member {string} [provisioningState] The provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface SecurityRule extends SubResource { + description?: string; + protocol: string; + sourcePortRange?: string; + destinationPortRange?: string; + sourceAddressPrefix?: string; + sourceAddressPrefixes?: string[]; + sourceApplicationSecurityGroups?: ApplicationSecurityGroup[]; + destinationAddressPrefix?: string; + destinationAddressPrefixes?: string[]; + destinationApplicationSecurityGroups?: ApplicationSecurityGroup[]; + sourcePortRanges?: string[]; + destinationPortRanges?: string[]; + access: string; + priority?: number; + direction: string; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceDnsSettings class. + * @constructor + * DNS settings of a network interface. + * + * @member {array} [dnsServers] List of DNS servers IP addresses. Use + * 'AzureProvidedDNS' to switch to azure provided DNS resolution. + * 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the + * only value in dnsServers collection. + * @member {array} [appliedDnsServers] If the VM that uses this NIC is part of + * an Availability Set, then this list will have the union of all DNS servers + * from all NICs that are part of the Availability Set. This property is what + * is configured on each of those VMs. + * @member {string} [internalDnsNameLabel] Relative DNS name for this NIC used + * for internal communications between VMs in the same virtual network. + * @member {string} [internalFqdn] Fully qualified DNS name supporting internal + * communications between VMs in the same virtual network. + * @member {string} [internalDomainNameSuffix] Even if internalDnsNameLabel is + * not specified, a DNS entry is created for the primary NIC of the VM. This + * DNS name can be constructed by concatenating the VM name with the value of + * internalDomainNameSuffix. + */ +export interface NetworkInterfaceDnsSettings { + dnsServers?: string[]; + appliedDnsServers?: string[]; + internalDnsNameLabel?: string; + internalFqdn?: string; + internalDomainNameSuffix?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterface class. + * @constructor + * A network interface in a resource group. + * + * @member {object} [virtualMachine] The reference of a virtual machine. + * @member {string} [virtualMachine.id] Resource ID. + * @member {object} [networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [networkSecurityGroup.defaultSecurityRules] The default + * security rules of network security group. + * @member {array} [networkSecurityGroup.networkInterfaces] A collection of + * references to network interfaces. + * @member {array} [networkSecurityGroup.subnets] A collection of references to + * subnets. + * @member {string} [networkSecurityGroup.resourceGuid] The resource GUID + * property of the network security group resource. + * @member {string} [networkSecurityGroup.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [networkSecurityGroup.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [ipConfigurations] A list of IPConfigurations of the network + * interface. + * @member {object} [dnsSettings] The DNS settings in network interface. + * @member {array} [dnsSettings.dnsServers] List of DNS servers IP addresses. + * Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. + * 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the + * only value in dnsServers collection. + * @member {array} [dnsSettings.appliedDnsServers] If the VM that uses this NIC + * is part of an Availability Set, then this list will have the union of all + * DNS servers from all NICs that are part of the Availability Set. This + * property is what is configured on each of those VMs. + * @member {string} [dnsSettings.internalDnsNameLabel] Relative DNS name for + * this NIC used for internal communications between VMs in the same virtual + * network. + * @member {string} [dnsSettings.internalFqdn] Fully qualified DNS name + * supporting internal communications between VMs in the same virtual network. + * @member {string} [dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * @member {string} [macAddress] The MAC address of the network interface. + * @member {boolean} [primary] Gets whether this is a primary network interface + * on a virtual machine. + * @member {boolean} [enableAcceleratedNetworking] If the network interface is + * accelerated networking enabled. + * @member {boolean} [enableIPForwarding] Indicates whether IP forwarding is + * enabled on this network interface. + * @member {string} [resourceGuid] The resource GUID property of the network + * interface resource. + * @member {string} [provisioningState] The provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface NetworkInterface extends Resource { + virtualMachine?: SubResource; + networkSecurityGroup?: NetworkSecurityGroup; + ipConfigurations?: NetworkInterfaceIPConfiguration[]; + dnsSettings?: NetworkInterfaceDnsSettings; + macAddress?: string; + primary?: boolean; + enableAcceleratedNetworking?: boolean; + enableIPForwarding?: boolean; + resourceGuid?: string; + provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkSecurityGroup class. + * @constructor + * NetworkSecurityGroup resource. + * + * @member {array} [securityRules] A collection of security rules of the + * network security group. + * @member {array} [defaultSecurityRules] The default security rules of network + * security group. + * @member {array} [networkInterfaces] A collection of references to network + * interfaces. + * @member {array} [subnets] A collection of references to subnets. + * @member {string} [resourceGuid] The resource GUID property of the network + * security group resource. + * @member {string} [provisioningState] The provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface NetworkSecurityGroup extends Resource { + securityRules?: SecurityRule[]; + defaultSecurityRules?: SecurityRule[]; + readonly networkInterfaces?: NetworkInterface[]; + readonly subnets?: Subnet[]; + resourceGuid?: string; + provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the Route class. + * @constructor + * Route resource + * + * @member {string} [addressPrefix] The destination CIDR to which the route + * applies. + * @member {string} nextHopType The type of Azure hop the packet should be sent + * to. Possible values are: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', and 'None'. Possible values include: + * 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', 'None' + * @member {string} [nextHopIpAddress] The IP address packets should be + * forwarded to. Next hop values are only allowed in routes where the next hop + * type is VirtualAppliance. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface Route extends SubResource { + addressPrefix?: string; + nextHopType: string; + nextHopIpAddress?: string; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the RouteTable class. + * @constructor + * Route table resource. + * + * @member {array} [routes] Collection of routes contained within a route + * table. + * @member {array} [subnets] A collection of references to subnets. + * @member {boolean} [disableBgpRoutePropagation] Gets or sets whether to + * disable the routes learned by BGP on that route table. True means disable. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface RouteTable extends Resource { + routes?: Route[]; + readonly subnets?: Subnet[]; + disableBgpRoutePropagation?: boolean; + provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ServiceEndpointPropertiesFormat class. + * @constructor + * The service endpoint properties. + * + * @member {string} [service] The type of the endpoint service. + * @member {array} [locations] A list of locations. + * @member {string} [provisioningState] The provisioning state of the resource. + */ +export interface ServiceEndpointPropertiesFormat { + service?: string; + locations?: string[]; + provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the PublicIPAddressSku class. + * @constructor + * SKU of a public IP address + * + * @member {string} [name] Name of a public IP address SKU. Possible values + * include: 'Basic', 'Standard' + */ +export interface PublicIPAddressSku { + name?: string; +} + +/** + * @class + * Initializes a new instance of the PublicIPAddressDnsSettings class. + * @constructor + * Contains FQDN of the DNS record associated with the public IP address + * + * @member {string} [domainNameLabel] Gets or sets the Domain name label.The + * concatenation of the domain name label and the regionalized DNS zone make up + * the fully qualified domain name associated with the public IP address. If a + * domain name label is specified, an A DNS record is created for the public IP + * in the Microsoft Azure DNS system. + * @member {string} [fqdn] Gets the FQDN, Fully qualified domain name of the A + * DNS record associated with the public IP. This is the concatenation of the + * domainNameLabel and the regionalized DNS zone. + * @member {string} [reverseFqdn] Gets or Sets the Reverse FQDN. A + * user-visible, fully qualified domain name that resolves to this public IP + * address. If the reverseFqdn is specified, then a PTR DNS record is created + * pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. + */ +export interface PublicIPAddressDnsSettings { + domainNameLabel?: string; + fqdn?: string; + reverseFqdn?: string; +} + +/** + * @class + * Initializes a new instance of the IpTag class. + * @constructor + * Contains the IpTag associated with the public IP address + * + * @member {string} [ipTagType] Gets or sets the ipTag type: Example + * FirstPartyUsage. + * @member {string} [tag] Gets or sets value of the IpTag associated with the + * public IP. Example SQL, Storage etc + */ +export interface IpTag { + ipTagType?: string; + tag?: string; +} + +/** + * @class + * Initializes a new instance of the PublicIPAddress class. + * @constructor + * Public IP address resource. + * + * @member {object} [sku] The public IP address SKU. + * @member {string} [sku.name] Name of a public IP address SKU. Possible values + * include: 'Basic', 'Standard' + * @member {string} [publicIPAllocationMethod] The public IP allocation method. + * Possible values are: 'Static' and 'Dynamic'. Possible values include: + * 'Static', 'Dynamic' + * @member {string} [publicIPAddressVersion] The public IP address version. + * Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + * 'IPv6' + * @member {object} [ipConfiguration] The IP configuration associated with the + * public IP address. + * @member {string} [ipConfiguration.privateIPAddress] The private IP address + * of the IP configuration. + * @member {string} [ipConfiguration.privateIPAllocationMethod] The private IP + * allocation method. Possible values are 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {object} [ipConfiguration.subnet] The reference of the subnet + * resource. + * @member {string} [ipConfiguration.subnet.addressPrefix] The address prefix + * for the subnet. + * @member {object} [ipConfiguration.subnet.networkSecurityGroup] The reference + * of the NetworkSecurityGroup resource. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] A collection + * of references to network interfaces. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.subnet.routeTable] The reference of the + * RouteTable resource. + * @member {array} [ipConfiguration.subnet.routeTable.routes] Collection of + * routes contained within a route table. + * @member {array} [ipConfiguration.subnet.routeTable.subnets] A collection of + * references to subnets. + * @member {boolean} + * [ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * @member {string} [ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.routeTable.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.subnet.serviceEndpoints] An array of + * service endpoints. + * @member {array} [ipConfiguration.subnet.ipConfigurations] Gets an array of + * references to the network interface IP configurations using subnet. + * @member {array} [ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [ipConfiguration.subnet.provisioningState] The provisioning + * state of the resource. + * @member {string} [ipConfiguration.subnet.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.subnet.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {object} [ipConfiguration.publicIPAddress] The reference of the + * public IP resource. + * @member {string} [ipConfiguration.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {object} [dnsSettings] The FQDN of the DNS record associated with + * the public IP address. + * @member {string} [dnsSettings.domainNameLabel] Gets or sets the Domain name + * label.The concatenation of the domain name label and the regionalized DNS + * zone make up the fully qualified domain name associated with the public IP + * address. If a domain name label is specified, an A DNS record is created for + * the public IP in the Microsoft Azure DNS system. + * @member {string} [dnsSettings.fqdn] Gets the FQDN, Fully qualified domain + * name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * @member {string} [dnsSettings.reverseFqdn] Gets or Sets the Reverse FQDN. A + * user-visible, fully qualified domain name that resolves to this public IP + * address. If the reverseFqdn is specified, then a PTR DNS record is created + * pointing from the IP address in the in-addr.arpa domain to the reverse FQDN. + * @member {array} [ipTags] The list of tags associated with the public IP + * address. + * @member {string} [ipAddress] The IP address associated with the public IP + * address resource. + * @member {number} [idleTimeoutInMinutes] The idle timeout of the public IP + * address. + * @member {string} [resourceGuid] The resource GUID property of the public IP + * resource. + * @member {string} [provisioningState] The provisioning state of the PublicIP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {array} [zones] A list of availability zones denoting the IP + * allocated for the resource needs to come from. + */ +export interface PublicIPAddress extends Resource { + sku?: PublicIPAddressSku; + publicIPAllocationMethod?: string; + publicIPAddressVersion?: string; + readonly ipConfiguration?: IPConfiguration; + dnsSettings?: PublicIPAddressDnsSettings; + ipTags?: IpTag[]; + ipAddress?: string; + idleTimeoutInMinutes?: number; + resourceGuid?: string; + provisioningState?: string; + etag?: string; + zones?: string[]; +} + +/** + * @class + * Initializes a new instance of the IPConfiguration class. + * @constructor + * IP configuration + * + * @member {string} [privateIPAddress] The private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] The private IP allocation + * method. Possible values are 'Static' and 'Dynamic'. Possible values include: + * 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A collection + * of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. True + * means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to the + * network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of references + * to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {object} [publicIPAddress] The reference of the public IP resource. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or sets + * the Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated with + * the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout of + * the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface IPConfiguration extends SubResource { + privateIPAddress?: string; + privateIPAllocationMethod?: string; + subnet?: Subnet; + publicIPAddress?: PublicIPAddress; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ResourceNavigationLink class. + * @constructor + * ResourceNavigationLink resource. + * + * @member {string} [linkedResourceType] Resource type of the linked resource. + * @member {string} [link] Link to the external resource + * @member {string} [provisioningState] Provisioning state of the + * ResourceNavigationLink resource. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ResourceNavigationLink extends SubResource { + linkedResourceType?: string; + link?: string; + readonly provisioningState?: string; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the Subnet class. + * @constructor + * Subnet in a virtual network resource. + * + * @member {string} [addressPrefix] The address prefix for the subnet. + * @member {object} [networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [networkSecurityGroup.defaultSecurityRules] The default + * security rules of network security group. + * @member {array} [networkSecurityGroup.networkInterfaces] A collection of + * references to network interfaces. + * @member {array} [networkSecurityGroup.subnets] A collection of references to + * subnets. + * @member {string} [networkSecurityGroup.resourceGuid] The resource GUID + * property of the network security group resource. + * @member {string} [networkSecurityGroup.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [networkSecurityGroup.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {object} [routeTable] The reference of the RouteTable resource. + * @member {array} [routeTable.routes] Collection of routes contained within a + * route table. + * @member {array} [routeTable.subnets] A collection of references to subnets. + * @member {boolean} [routeTable.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * @member {string} [routeTable.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [routeTable.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {array} [serviceEndpoints] An array of service endpoints. + * @member {array} [ipConfigurations] Gets an array of references to the + * network interface IP configurations using subnet. + * @member {array} [resourceNavigationLinks] Gets an array of references to the + * external resources using subnet. + * @member {string} [provisioningState] The provisioning state of the resource. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface Subnet extends SubResource { + addressPrefix?: string; + networkSecurityGroup?: NetworkSecurityGroup; + routeTable?: RouteTable; + serviceEndpoints?: ServiceEndpointPropertiesFormat[]; + readonly ipConfigurations?: IPConfiguration[]; + resourceNavigationLinks?: ResourceNavigationLink[]; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceIPConfiguration class. + * @constructor + * IPConfiguration in a network interface. + * + * @member {array} [applicationGatewayBackendAddressPools] The reference of + * ApplicationGatewayBackendAddressPool resource. + * @member {array} [loadBalancerBackendAddressPools] The reference of + * LoadBalancerBackendAddressPool resource. + * @member {array} [loadBalancerInboundNatRules] A list of references of + * LoadBalancerInboundNatRules. + * @member {string} [privateIPAddress] Private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] Defines how a private IP + * address is assigned. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [privateIPAddressVersion] Available from Api-Version + * 2016-03-30 onwards, it represents whether the specific ipconfiguration is + * IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and + * 'IPv6'. Possible values include: 'IPv4', 'IPv6' + * @member {object} [subnet] Subnet bound to the IP configuration. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A collection + * of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. True + * means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to the + * network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of references + * to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {boolean} [primary] Gets whether this is a primary customer address + * on the network interface. + * @member {object} [publicIPAddress] Public IP address bound to the IP + * configuration. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} [publicIPAddress.ipConfiguration.subnet] The reference of + * the subnet resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.addressPrefix] The + * address prefix for the subnet. + * @member {object} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] The reference + * of the NetworkSecurityGroup resource. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} [publicIPAddress.ipConfiguration.subnet.serviceEndpoints] An + * array of service endpoints. + * @member {array} [publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations using + * subnet. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} [publicIPAddress.ipConfiguration.provisioningState] Gets + * the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [publicIPAddress.ipConfiguration.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or sets + * the Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated with + * the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout of + * the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {array} [applicationSecurityGroups] Application security groups in + * which the IP configuration is included. + * @member {string} [provisioningState] The provisioning state of the network + * interface IP configuration. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface NetworkInterfaceIPConfiguration extends SubResource { + applicationGatewayBackendAddressPools?: ApplicationGatewayBackendAddressPool[]; + loadBalancerBackendAddressPools?: BackendAddressPool[]; + loadBalancerInboundNatRules?: InboundNatRule[]; + privateIPAddress?: string; + privateIPAllocationMethod?: string; + privateIPAddressVersion?: string; + subnet?: Subnet; + primary?: boolean; + publicIPAddress?: PublicIPAddress; + applicationSecurityGroups?: ApplicationSecurityGroup[]; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendAddress class. + * @constructor + * Backend address of an application gateway. + * + * @member {string} [fqdn] Fully qualified domain name (FQDN). + * @member {string} [ipAddress] IP address + */ +export interface ApplicationGatewayBackendAddress { + fqdn?: string; + ipAddress?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendAddressPool class. + * @constructor + * Backend Address Pool of an application gateway. + * + * @member {array} [backendIPConfigurations] Collection of references to IPs + * defined in network interfaces. + * @member {array} [backendAddresses] Backend addresses + * @member {string} [provisioningState] Provisioning state of the backend + * address pool resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Resource that is unique within a resource group. + * This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayBackendAddressPool extends SubResource { + backendIPConfigurations?: NetworkInterfaceIPConfiguration[]; + backendAddresses?: ApplicationGatewayBackendAddress[]; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayConnectionDraining class. + * @constructor + * Connection draining allows open connections to a backend server to be active + * for a specified time after the backend server got removed from the + * configuration. + * + * @member {boolean} enabled Whether connection draining is enabled or not. + * @member {number} drainTimeoutInSec The number of seconds connection draining + * is active. Acceptable values are from 1 second to 3600 seconds. + */ +export interface ApplicationGatewayConnectionDraining { + enabled: boolean; + drainTimeoutInSec: number; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendHttpSettings class. + * @constructor + * Backend address pool settings of an application gateway. + * + * @member {number} [port] Port + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [cookieBasedAffinity] Cookie based affinity. Possible + * values include: 'Enabled', 'Disabled' + * @member {number} [requestTimeout] Request timeout in seconds. Application + * Gateway will fail the request if response is not received within + * RequestTimeout. Acceptable values are from 1 second to 86400 seconds. + * @member {object} [probe] Probe resource of an application gateway. + * @member {string} [probe.id] Resource ID. + * @member {array} [authenticationCertificates] Array of references to + * application gateway authentication certificates. + * @member {object} [connectionDraining] Connection draining of the backend + * http settings resource. + * @member {boolean} [connectionDraining.enabled] Whether connection draining + * is enabled or not. + * @member {number} [connectionDraining.drainTimeoutInSec] The number of + * seconds connection draining is active. Acceptable values are from 1 second + * to 3600 seconds. + * @member {string} [hostName] Host header to be sent to the backend servers. + * @member {boolean} [pickHostNameFromBackendAddress] Whether to pick host + * header should be picked from the host name of the backend server. Default + * value is false. + * @member {string} [affinityCookieName] Cookie name to use for the affinity + * cookie. + * @member {boolean} [probeEnabled] Whether the probe is enabled. Default value + * is false. + * @member {string} [path] Path which should be used as a prefix for all HTTP + * requests. Null means no path will be prefixed. Default value is null. + * @member {string} [provisioningState] Provisioning state of the backend http + * settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayBackendHttpSettings extends SubResource { + port?: number; + protocol?: string; + cookieBasedAffinity?: string; + requestTimeout?: number; + probe?: SubResource; + authenticationCertificates?: SubResource[]; + connectionDraining?: ApplicationGatewayConnectionDraining; + hostName?: string; + pickHostNameFromBackendAddress?: boolean; + affinityCookieName?: string; + probeEnabled?: boolean; + path?: string; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendHealthServer class. + * @constructor + * Application gateway backendhealth http settings. + * + * @member {string} [address] IP address or FQDN of backend server. + * @member {object} [ipConfiguration] Reference of IP configuration of backend + * server. + * @member {array} [ipConfiguration.applicationGatewayBackendAddressPools] The + * reference of ApplicationGatewayBackendAddressPool resource. + * @member {array} [ipConfiguration.loadBalancerBackendAddressPools] The + * reference of LoadBalancerBackendAddressPool resource. + * @member {array} [ipConfiguration.loadBalancerInboundNatRules] A list of + * references of LoadBalancerInboundNatRules. + * @member {string} [ipConfiguration.privateIPAddress] Private IP address of + * the IP configuration. + * @member {string} [ipConfiguration.privateIPAllocationMethod] Defines how a + * private IP address is assigned. Possible values are: 'Static' and 'Dynamic'. + * Possible values include: 'Static', 'Dynamic' + * @member {string} [ipConfiguration.privateIPAddressVersion] Available from + * Api-Version 2016-03-30 onwards, it represents whether the specific + * ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + * are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', 'IPv6' + * @member {object} [ipConfiguration.subnet] Subnet bound to the IP + * configuration. + * @member {string} [ipConfiguration.subnet.addressPrefix] The address prefix + * for the subnet. + * @member {object} [ipConfiguration.subnet.networkSecurityGroup] The reference + * of the NetworkSecurityGroup resource. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] A collection + * of references to network interfaces. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.subnet.routeTable] The reference of the + * RouteTable resource. + * @member {array} [ipConfiguration.subnet.routeTable.routes] Collection of + * routes contained within a route table. + * @member {array} [ipConfiguration.subnet.routeTable.subnets] A collection of + * references to subnets. + * @member {boolean} + * [ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * @member {string} [ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.routeTable.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.subnet.serviceEndpoints] An array of + * service endpoints. + * @member {array} [ipConfiguration.subnet.ipConfigurations] Gets an array of + * references to the network interface IP configurations using subnet. + * @member {array} [ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [ipConfiguration.subnet.provisioningState] The provisioning + * state of the resource. + * @member {string} [ipConfiguration.subnet.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.subnet.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {boolean} [ipConfiguration.primary] Gets whether this is a primary + * customer address on the network interface. + * @member {object} [ipConfiguration.publicIPAddress] Public IP address bound + * to the IP configuration. + * @member {object} [ipConfiguration.publicIPAddress.sku] The public IP address + * SKU. + * @member {string} [ipConfiguration.publicIPAddress.sku.name] Name of a public + * IP address SKU. Possible values include: 'Basic', 'Standard' + * @member {string} [ipConfiguration.publicIPAddress.publicIPAllocationMethod] + * The public IP allocation method. Possible values are: 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {string} [ipConfiguration.publicIPAddress.publicIPAddressVersion] + * The public IP address version. Possible values are: 'IPv4' and 'IPv6'. + * Possible values include: 'IPv4', 'IPv6' + * @member {object} [ipConfiguration.publicIPAddress.ipConfiguration] The IP + * configuration associated with the public IP address. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} [ipConfiguration.publicIPAddress.ipConfiguration.subnet] + * The reference of the subnet resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.addressPrefix] The + * address prefix for the subnet. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] + * The reference of the NetworkSecurityGroup resource. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] + * A collection of references to subnets. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] + * A unique read-only string that changes whenever the resource is updated. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] + * The provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.serviceEndpoints] An + * array of service endpoints. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations using + * subnet. + * @member {array} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] + * Gets an array of references to the external resources using subnet. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} + * [ipConfiguration.publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} + * [ipConfiguration.publicIPAddress.ipConfiguration.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.publicIPAddress.ipConfiguration.name] The + * name of the resource that is unique within a resource group. This name can + * be used to access the resource. + * @member {string} [ipConfiguration.publicIPAddress.ipConfiguration.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.publicIPAddress.dnsSettings] The FQDN of + * the DNS record associated with the public IP address. + * @member {string} + * [ipConfiguration.publicIPAddress.dnsSettings.domainNameLabel] Gets or sets + * the Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [ipConfiguration.publicIPAddress.dnsSettings.fqdn] Gets the + * FQDN, Fully qualified domain name of the A DNS record associated with the + * public IP. This is the concatenation of the domainNameLabel and the + * regionalized DNS zone. + * @member {string} [ipConfiguration.publicIPAddress.dnsSettings.reverseFqdn] + * Gets or Sets the Reverse FQDN. A user-visible, fully qualified domain name + * that resolves to this public IP address. If the reverseFqdn is specified, + * then a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [ipConfiguration.publicIPAddress.ipTags] The list of tags + * associated with the public IP address. + * @member {string} [ipConfiguration.publicIPAddress.ipAddress] The IP address + * associated with the public IP address resource. + * @member {number} [ipConfiguration.publicIPAddress.idleTimeoutInMinutes] The + * idle timeout of the public IP address. + * @member {string} [ipConfiguration.publicIPAddress.resourceGuid] The resource + * GUID property of the public IP resource. + * @member {string} [ipConfiguration.publicIPAddress.provisioningState] The + * provisioning state of the PublicIP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.publicIPAddress.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.publicIPAddress.zones] A list of + * availability zones denoting the IP allocated for the resource needs to come + * from. + * @member {array} [ipConfiguration.applicationSecurityGroups] Application + * security groups in which the IP configuration is included. + * @member {string} [ipConfiguration.provisioningState] The provisioning state + * of the network interface IP configuration. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [health] Health of backend server. Possible values include: + * 'Unknown', 'Up', 'Down', 'Partial', 'Draining' + */ +export interface ApplicationGatewayBackendHealthServer { + address?: string; + ipConfiguration?: NetworkInterfaceIPConfiguration; + health?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendHealthHttpSettings class. + * @constructor + * Application gateway BackendHealthHttp settings. + * + * @member {object} [backendHttpSettings] Reference of an + * ApplicationGatewayBackendHttpSettings resource. + * @member {number} [backendHttpSettings.port] Port + * @member {string} [backendHttpSettings.protocol] Protocol. Possible values + * include: 'Http', 'Https' + * @member {string} [backendHttpSettings.cookieBasedAffinity] Cookie based + * affinity. Possible values include: 'Enabled', 'Disabled' + * @member {number} [backendHttpSettings.requestTimeout] Request timeout in + * seconds. Application Gateway will fail the request if response is not + * received within RequestTimeout. Acceptable values are from 1 second to 86400 + * seconds. + * @member {object} [backendHttpSettings.probe] Probe resource of an + * application gateway. + * @member {string} [backendHttpSettings.probe.id] Resource ID. + * @member {array} [backendHttpSettings.authenticationCertificates] Array of + * references to application gateway authentication certificates. + * @member {object} [backendHttpSettings.connectionDraining] Connection + * draining of the backend http settings resource. + * @member {boolean} [backendHttpSettings.connectionDraining.enabled] Whether + * connection draining is enabled or not. + * @member {number} [backendHttpSettings.connectionDraining.drainTimeoutInSec] + * The number of seconds connection draining is active. Acceptable values are + * from 1 second to 3600 seconds. + * @member {string} [backendHttpSettings.hostName] Host header to be sent to + * the backend servers. + * @member {boolean} [backendHttpSettings.pickHostNameFromBackendAddress] + * Whether to pick host header should be picked from the host name of the + * backend server. Default value is false. + * @member {string} [backendHttpSettings.affinityCookieName] Cookie name to use + * for the affinity cookie. + * @member {boolean} [backendHttpSettings.probeEnabled] Whether the probe is + * enabled. Default value is false. + * @member {string} [backendHttpSettings.path] Path which should be used as a + * prefix for all HTTP requests. Null means no path will be prefixed. Default + * value is null. + * @member {string} [backendHttpSettings.provisioningState] Provisioning state + * of the backend http settings resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [backendHttpSettings.name] Name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [backendHttpSettings.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [backendHttpSettings.type] Type of the resource. + * @member {array} [servers] List of ApplicationGatewayBackendHealthServer + * resources. + */ +export interface ApplicationGatewayBackendHealthHttpSettings { + backendHttpSettings?: ApplicationGatewayBackendHttpSettings; + servers?: ApplicationGatewayBackendHealthServer[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendHealthPool class. + * @constructor + * Application gateway BackendHealth pool. + * + * @member {object} [backendAddressPool] Reference of an + * ApplicationGatewayBackendAddressPool resource. + * @member {array} [backendAddressPool.backendIPConfigurations] Collection of + * references to IPs defined in network interfaces. + * @member {array} [backendAddressPool.backendAddresses] Backend addresses + * @member {string} [backendAddressPool.provisioningState] Provisioning state + * of the backend address pool resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [backendAddressPool.name] Resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [backendAddressPool.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} [backendAddressPool.type] Type of the resource. + * @member {array} [backendHttpSettingsCollection] List of + * ApplicationGatewayBackendHealthHttpSettings resources. + */ +export interface ApplicationGatewayBackendHealthPool { + backendAddressPool?: ApplicationGatewayBackendAddressPool; + backendHttpSettingsCollection?: ApplicationGatewayBackendHealthHttpSettings[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayBackendHealth class. + * @constructor + * List of ApplicationGatewayBackendHealthPool resources. + * + * @member {array} [backendAddressPools] + */ +export interface ApplicationGatewayBackendHealth { + backendAddressPools?: ApplicationGatewayBackendHealthPool[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewaySku class. + * @constructor + * SKU of an application gateway + * + * @member {string} [name] Name of an application gateway SKU. Possible values + * include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', + * 'WAF_Medium', 'WAF_Large' + * @member {string} [tier] Tier of an application gateway. Possible values + * include: 'Standard', 'WAF' + * @member {number} [capacity] Capacity (instance count) of an application + * gateway. + */ +export interface ApplicationGatewaySku { + name?: string; + tier?: string; + capacity?: number; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewaySslPolicy class. + * @constructor + * Application Gateway Ssl policy. + * + * @member {array} [disabledSslProtocols] Ssl protocols to be disabled on + * application gateway. + * @member {string} [policyType] Type of Ssl Policy. Possible values include: + * 'Predefined', 'Custom' + * @member {string} [policyName] Name of Ssl predefined policy. Possible values + * include: 'AppGwSslPolicy20150501', 'AppGwSslPolicy20170401', + * 'AppGwSslPolicy20170401S' + * @member {array} [cipherSuites] Ssl cipher suites to be enabled in the + * specified order to application gateway. + * @member {string} [minProtocolVersion] Minimum version of Ssl protocol to be + * supported on application gateway. Possible values include: 'TLSv1_0', + * 'TLSv1_1', 'TLSv1_2' + */ +export interface ApplicationGatewaySslPolicy { + disabledSslProtocols?: string[]; + policyType?: string; + policyName?: string; + cipherSuites?: string[]; + minProtocolVersion?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayIPConfiguration class. + * @constructor + * IP configuration of an application gateway. Currently 1 public and 1 private + * IP configuration is allowed. + * + * @member {object} [subnet] Reference of the subnet resource. A subnet from + * where application gateway gets its private address. + * @member {string} [subnet.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the application + * gateway subnet resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayIPConfiguration extends SubResource { + subnet?: SubResource; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayAuthenticationCertificate class. + * @constructor + * Authentication certificates of an application gateway. + * + * @member {string} [data] Certificate public data. + * @member {string} [provisioningState] Provisioning state of the + * authentication certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayAuthenticationCertificate extends SubResource { + data?: string; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewaySslCertificate class. + * @constructor + * SSL certificates of an application gateway. + * + * @member {string} [data] Base-64 encoded pfx certificate. Only applicable in + * PUT Request. + * @member {string} [password] Password for the pfx file specified in data. + * Only applicable in PUT request. + * @member {string} [publicCertData] Base-64 encoded Public cert data + * corresponding to pfx specified in data. Only applicable in GET request. + * @member {string} [provisioningState] Provisioning state of the SSL + * certificate resource Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewaySslCertificate extends SubResource { + data?: string; + password?: string; + publicCertData?: string; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFrontendIPConfiguration class. + * @constructor + * Frontend IP configuration of an application gateway. + * + * @member {string} [privateIPAddress] PrivateIPAddress of the network + * interface IP Configuration. + * @member {string} [privateIPAllocationMethod] PrivateIP allocation method. + * Possible values include: 'Static', 'Dynamic' + * @member {object} [subnet] Reference of the subnet resource. + * @member {string} [subnet.id] Resource ID. + * @member {object} [publicIPAddress] Reference of the PublicIP resource. + * @member {string} [publicIPAddress.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayFrontendIPConfiguration extends SubResource { + privateIPAddress?: string; + privateIPAllocationMethod?: string; + subnet?: SubResource; + publicIPAddress?: SubResource; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFrontendPort class. + * @constructor + * Frontend port of an application gateway. + * + * @member {number} [port] Frontend port + * @member {string} [provisioningState] Provisioning state of the frontend port + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayFrontendPort extends SubResource { + port?: number; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayHttpListener class. + * @constructor + * Http listener of an application gateway. + * + * @member {object} [frontendIPConfiguration] Frontend IP configuration + * resource of an application gateway. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [frontendPort] Frontend port resource of an application + * gateway. + * @member {string} [frontendPort.id] Resource ID. + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [hostName] Host name of HTTP listener. + * @member {object} [sslCertificate] SSL certificate resource of an application + * gateway. + * @member {string} [sslCertificate.id] Resource ID. + * @member {boolean} [requireServerNameIndication] Applicable only if protocol + * is https. Enables SNI for multi-hosting. + * @member {string} [provisioningState] Provisioning state of the HTTP listener + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayHttpListener extends SubResource { + frontendIPConfiguration?: SubResource; + frontendPort?: SubResource; + protocol?: string; + hostName?: string; + sslCertificate?: SubResource; + requireServerNameIndication?: boolean; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayPathRule class. + * @constructor + * Path rule of URL path map of an application gateway. + * + * @member {array} [paths] Path rules of URL path map. + * @member {object} [backendAddressPool] Backend address pool resource of URL + * path map path rule. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [backendHttpSettings] Backend http settings resource of URL + * path map path rule. + * @member {string} [backendHttpSettings.id] Resource ID. + * @member {object} [redirectConfiguration] Redirect configuration resource of + * URL path map path rule. + * @member {string} [redirectConfiguration.id] Resource ID. + * @member {string} [provisioningState] Path rule of URL path map resource. + * Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayPathRule extends SubResource { + paths?: string[]; + backendAddressPool?: SubResource; + backendHttpSettings?: SubResource; + redirectConfiguration?: SubResource; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayProbeHealthResponseMatch class. + * @constructor + * Application gateway probe health response match + * + * @member {string} [body] Body that must be contained in the health response. + * Default value is empty. + * @member {array} [statusCodes] Allowed ranges of healthy status codes. + * Default range of healthy status codes is 200-399. + */ +export interface ApplicationGatewayProbeHealthResponseMatch { + body?: string; + statusCodes?: string[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayProbe class. + * @constructor + * Probe of the application gateway. + * + * @member {string} [protocol] Protocol. Possible values include: 'Http', + * 'Https' + * @member {string} [host] Host name to send the probe to. + * @member {string} [path] Relative path of probe. Valid path starts from '/'. + * Probe is sent to ://: + * @member {number} [interval] The probing interval in seconds. This is the + * time interval between two consecutive probes. Acceptable values are from 1 + * second to 86400 seconds. + * @member {number} [timeout] the probe timeout in seconds. Probe marked as + * failed if valid response is not received with this timeout period. + * Acceptable values are from 1 second to 86400 seconds. + * @member {number} [unhealthyThreshold] The probe retry count. Backend server + * is marked down after consecutive probe failure count reaches + * UnhealthyThreshold. Acceptable values are from 1 second to 20. + * @member {boolean} [pickHostNameFromBackendHttpSettings] Whether the host + * header should be picked from the backend http settings. Default value is + * false. + * @member {number} [minServers] Minimum number of servers that are always + * marked healthy. Default value is 0. + * @member {object} [match] Criterion for classifying a healthy probe response. + * @member {string} [match.body] Body that must be contained in the health + * response. Default value is empty. + * @member {array} [match.statusCodes] Allowed ranges of healthy status codes. + * Default range of healthy status codes is 200-399. + * @member {string} [provisioningState] Provisioning state of the backend http + * settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayProbe extends SubResource { + protocol?: string; + host?: string; + path?: string; + interval?: number; + timeout?: number; + unhealthyThreshold?: number; + pickHostNameFromBackendHttpSettings?: boolean; + minServers?: number; + match?: ApplicationGatewayProbeHealthResponseMatch; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayRequestRoutingRule class. + * @constructor + * Request routing rule of an application gateway. + * + * @member {string} [ruleType] Rule type. Possible values include: 'Basic', + * 'PathBasedRouting' + * @member {object} [backendAddressPool] Backend address pool resource of the + * application gateway. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [backendHttpSettings] Frontend port resource of the + * application gateway. + * @member {string} [backendHttpSettings.id] Resource ID. + * @member {object} [httpListener] Http listener resource of the application + * gateway. + * @member {string} [httpListener.id] Resource ID. + * @member {object} [urlPathMap] URL path map resource of the application + * gateway. + * @member {string} [urlPathMap.id] Resource ID. + * @member {object} [redirectConfiguration] Redirect configuration resource of + * the application gateway. + * @member {string} [redirectConfiguration.id] Resource ID. + * @member {string} [provisioningState] Provisioning state of the request + * routing rule resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayRequestRoutingRule extends SubResource { + ruleType?: string; + backendAddressPool?: SubResource; + backendHttpSettings?: SubResource; + httpListener?: SubResource; + urlPathMap?: SubResource; + redirectConfiguration?: SubResource; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayRedirectConfiguration class. + * @constructor + * Redirect configuration of an application gateway. + * + * @member {string} [redirectType] Supported http redirection types - + * Permanent, Temporary, Found, SeeOther. Possible values include: 'Permanent', + * 'Found', 'SeeOther', 'Temporary' + * @member {object} [targetListener] Reference to a listener to redirect the + * request to. + * @member {string} [targetListener.id] Resource ID. + * @member {string} [targetUrl] Url to redirect the request to. + * @member {boolean} [includePath] Include path in the redirected url. + * @member {boolean} [includeQueryString] Include query string in the + * redirected url. + * @member {array} [requestRoutingRules] Request routing specifying redirect + * configuration. + * @member {array} [urlPathMaps] Url path maps specifying default redirect + * configuration. + * @member {array} [pathRules] Path rules specifying redirect configuration. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayRedirectConfiguration extends SubResource { + redirectType?: string; + targetListener?: SubResource; + targetUrl?: string; + includePath?: boolean; + includeQueryString?: boolean; + requestRoutingRules?: SubResource[]; + urlPathMaps?: SubResource[]; + pathRules?: SubResource[]; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayUrlPathMap class. + * @constructor + * UrlPathMaps give a url path to the backend mapping information for + * PathBasedRouting. + * + * @member {object} [defaultBackendAddressPool] Default backend address pool + * resource of URL path map. + * @member {string} [defaultBackendAddressPool.id] Resource ID. + * @member {object} [defaultBackendHttpSettings] Default backend http settings + * resource of URL path map. + * @member {string} [defaultBackendHttpSettings.id] Resource ID. + * @member {object} [defaultRedirectConfiguration] Default redirect + * configuration resource of URL path map. + * @member {string} [defaultRedirectConfiguration.id] Resource ID. + * @member {array} [pathRules] Path rule of URL path map resource. + * @member {string} [provisioningState] Provisioning state of the backend http + * settings resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Type of the resource. + */ +export interface ApplicationGatewayUrlPathMap extends SubResource { + defaultBackendAddressPool?: SubResource; + defaultBackendHttpSettings?: SubResource; + defaultRedirectConfiguration?: SubResource; + pathRules?: ApplicationGatewayPathRule[]; + provisioningState?: string; + name?: string; + etag?: string; + type?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFirewallDisabledRuleGroup class. + * @constructor + * Allows to disable rules within a rule group or an entire rule group. + * + * @member {string} ruleGroupName The name of the rule group that will be + * disabled. + * @member {array} [rules] The list of rules that will be disabled. If null, + * all rules of the rule group will be disabled. + */ +export interface ApplicationGatewayFirewallDisabledRuleGroup { + ruleGroupName: string; + rules?: number[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayWebApplicationFirewallConfiguration class. + * @constructor + * Application gateway web application firewall configuration. + * + * @member {boolean} enabled Whether the web application firewall is enabled or + * not. + * @member {string} firewallMode Web application firewall mode. Possible values + * include: 'Detection', 'Prevention' + * @member {string} ruleSetType The type of the web application firewall rule + * set. Possible values are: 'OWASP'. + * @member {string} ruleSetVersion The version of the rule set type. + * @member {array} [disabledRuleGroups] The disabled rule groups. + * @member {boolean} [requestBodyCheck] Whether allow WAF to check request + * Body. + * @member {number} [maxRequestBodySize] Maxium request body size for WAF. + */ +export interface ApplicationGatewayWebApplicationFirewallConfiguration { + enabled: boolean; + firewallMode: string; + ruleSetType: string; + ruleSetVersion: string; + disabledRuleGroups?: ApplicationGatewayFirewallDisabledRuleGroup[]; + requestBodyCheck?: boolean; + maxRequestBodySize?: number; +} + +/** + * @class + * Initializes a new instance of the ApplicationGateway class. + * @constructor + * Application gateway resource + * + * @member {object} [sku] SKU of the application gateway resource. + * @member {string} [sku.name] Name of an application gateway SKU. Possible + * values include: 'Standard_Small', 'Standard_Medium', 'Standard_Large', + * 'WAF_Medium', 'WAF_Large' + * @member {string} [sku.tier] Tier of an application gateway. Possible values + * include: 'Standard', 'WAF' + * @member {number} [sku.capacity] Capacity (instance count) of an application + * gateway. + * @member {object} [sslPolicy] SSL policy of the application gateway resource. + * @member {array} [sslPolicy.disabledSslProtocols] Ssl protocols to be + * disabled on application gateway. + * @member {string} [sslPolicy.policyType] Type of Ssl Policy. Possible values + * include: 'Predefined', 'Custom' + * @member {string} [sslPolicy.policyName] Name of Ssl predefined policy. + * Possible values include: 'AppGwSslPolicy20150501', 'AppGwSslPolicy20170401', + * 'AppGwSslPolicy20170401S' + * @member {array} [sslPolicy.cipherSuites] Ssl cipher suites to be enabled in + * the specified order to application gateway. + * @member {string} [sslPolicy.minProtocolVersion] Minimum version of Ssl + * protocol to be supported on application gateway. Possible values include: + * 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * @member {string} [operationalState] Operational state of the application + * gateway resource. Possible values include: 'Stopped', 'Starting', 'Running', + * 'Stopping' + * @member {array} [gatewayIPConfigurations] Subnets of application the gateway + * resource. + * @member {array} [authenticationCertificates] Authentication certificates of + * the application gateway resource. + * @member {array} [sslCertificates] SSL certificates of the application + * gateway resource. + * @member {array} [frontendIPConfigurations] Frontend IP addresses of the + * application gateway resource. + * @member {array} [frontendPorts] Frontend ports of the application gateway + * resource. + * @member {array} [probes] Probes of the application gateway resource. + * @member {array} [backendAddressPools] Backend address pool of the + * application gateway resource. + * @member {array} [backendHttpSettingsCollection] Backend http settings of the + * application gateway resource. + * @member {array} [httpListeners] Http listeners of the application gateway + * resource. + * @member {array} [urlPathMaps] URL path map of the application gateway + * resource. + * @member {array} [requestRoutingRules] Request routing rules of the + * application gateway resource. + * @member {array} [redirectConfigurations] Redirect configurations of the + * application gateway resource. + * @member {object} [webApplicationFirewallConfiguration] Web application + * firewall configuration. + * @member {boolean} [webApplicationFirewallConfiguration.enabled] Whether the + * web application firewall is enabled or not. + * @member {string} [webApplicationFirewallConfiguration.firewallMode] Web + * application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * @member {string} [webApplicationFirewallConfiguration.ruleSetType] The type + * of the web application firewall rule set. Possible values are: 'OWASP'. + * @member {string} [webApplicationFirewallConfiguration.ruleSetVersion] The + * version of the rule set type. + * @member {array} [webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * @member {boolean} [webApplicationFirewallConfiguration.requestBodyCheck] + * Whether allow WAF to check request Body. + * @member {number} [webApplicationFirewallConfiguration.maxRequestBodySize] + * Maxium request body size for WAF. + * @member {boolean} [enableHttp2] Whether HTTP2 is enabled on the application + * gateway resource. + * @member {string} [resourceGuid] Resource GUID property of the application + * gateway resource. + * @member {string} [provisioningState] Provisioning state of the application + * gateway resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ApplicationGateway extends Resource { + sku?: ApplicationGatewaySku; + sslPolicy?: ApplicationGatewaySslPolicy; + readonly operationalState?: string; + gatewayIPConfigurations?: ApplicationGatewayIPConfiguration[]; + authenticationCertificates?: ApplicationGatewayAuthenticationCertificate[]; + sslCertificates?: ApplicationGatewaySslCertificate[]; + frontendIPConfigurations?: ApplicationGatewayFrontendIPConfiguration[]; + frontendPorts?: ApplicationGatewayFrontendPort[]; + probes?: ApplicationGatewayProbe[]; + backendAddressPools?: ApplicationGatewayBackendAddressPool[]; + backendHttpSettingsCollection?: ApplicationGatewayBackendHttpSettings[]; + httpListeners?: ApplicationGatewayHttpListener[]; + urlPathMaps?: ApplicationGatewayUrlPathMap[]; + requestRoutingRules?: ApplicationGatewayRequestRoutingRule[]; + redirectConfigurations?: ApplicationGatewayRedirectConfiguration[]; + webApplicationFirewallConfiguration?: ApplicationGatewayWebApplicationFirewallConfiguration; + enableHttp2?: boolean; + resourceGuid?: string; + provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFirewallRule class. + * @constructor + * A web application firewall rule. + * + * @member {number} ruleId The identifier of the web application firewall rule. + * @member {string} [description] The description of the web application + * firewall rule. + */ +export interface ApplicationGatewayFirewallRule { + ruleId: number; + description?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFirewallRuleGroup class. + * @constructor + * A web application firewall rule group. + * + * @member {string} ruleGroupName The name of the web application firewall rule + * group. + * @member {string} [description] The description of the web application + * firewall rule group. + * @member {array} rules The rules of the web application firewall rule group. + */ +export interface ApplicationGatewayFirewallRuleGroup { + ruleGroupName: string; + description?: string; + rules: ApplicationGatewayFirewallRule[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayFirewallRuleSet class. + * @constructor + * A web application firewall rule set. + * + * @member {string} [provisioningState] The provisioning state of the web + * application firewall rule set. + * @member {string} ruleSetType The type of the web application firewall rule + * set. + * @member {string} ruleSetVersion The version of the web application firewall + * rule set type. + * @member {array} ruleGroups The rule groups of the web application firewall + * rule set. + */ +export interface ApplicationGatewayFirewallRuleSet extends Resource { + provisioningState?: string; + ruleSetType: string; + ruleSetVersion: string; + ruleGroups: ApplicationGatewayFirewallRuleGroup[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayAvailableWafRuleSetsResult class. + * @constructor + * Response for ApplicationGatewayAvailableWafRuleSets API service call. + * + * @member {array} [value] The list of application gateway rule sets. + */ +export interface ApplicationGatewayAvailableWafRuleSetsResult { + value?: ApplicationGatewayFirewallRuleSet[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayAvailableSslOptions class. + * @constructor + * Response for ApplicationGatewayAvailableSslOptions API service call. + * + * @member {array} [predefinedPolicies] List of available Ssl predefined + * policy. + * @member {string} [defaultPolicy] Name of the Ssl predefined policy applied + * by default to application gateway. Possible values include: + * 'AppGwSslPolicy20150501', 'AppGwSslPolicy20170401', + * 'AppGwSslPolicy20170401S' + * @member {array} [availableCipherSuites] List of available Ssl cipher suites. + * @member {array} [availableProtocols] List of available Ssl protocols. + */ +export interface ApplicationGatewayAvailableSslOptions extends Resource { + predefinedPolicies?: SubResource[]; + defaultPolicy?: string; + availableCipherSuites?: string[]; + availableProtocols?: string[]; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewaySslPredefinedPolicy class. + * @constructor + * An Ssl predefined policy + * + * @member {string} [name] Name of Ssl predefined policy. + * @member {array} [cipherSuites] Ssl cipher suites to be enabled in the + * specified order for application gateway. + * @member {string} [minProtocolVersion] Minimum version of Ssl protocol to be + * supported on application gateway. Possible values include: 'TLSv1_0', + * 'TLSv1_1', 'TLSv1_2' + */ +export interface ApplicationGatewaySslPredefinedPolicy extends SubResource { + name?: string; + cipherSuites?: string[]; + minProtocolVersion?: string; +} + +/** + * @class + * Initializes a new instance of the TagsObject class. + * @constructor + * Tags object for patch operations. + * + * @member {object} [tags] Resource tags. + */ +export interface TagsObject { + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the DnsNameAvailabilityResult class. + * @constructor + * Response for the CheckDnsNameAvailability API service call. + * + * @member {boolean} [available] Domain availability (True/False). + */ +export interface DnsNameAvailabilityResult { + available?: boolean; +} + +/** + * @class + * Initializes a new instance of the DdosProtectionPlan class. + * @constructor + * A DDoS protection plan in a resource group. + * + * @member {string} [resourceGuid] The resource GUID property of the DDoS + * protection plan resource. It uniquely identifies the resource, even if the + * user changes its name or migrate the resource across subscriptions or + * resource groups. + * @member {string} [provisioningState] The provisioning state of the DDoS + * protection plan resource. Possible values are: 'Succeeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {array} [virtualNetworks] The list of virtual networks associated + * with the DDoS protection plan resource. This list is read-only. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface DdosProtectionPlan extends Resource { + readonly resourceGuid?: string; + readonly provisioningState?: string; + readonly virtualNetworks?: SubResource[]; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the EndpointServiceResult class. + * @constructor + * Endpoint service. + * + * @member {string} [name] Name of the endpoint service. + * @member {string} [type] Type of the endpoint service. + */ +export interface EndpointServiceResult extends SubResource { + readonly name?: string; + readonly type?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitAuthorization class. + * @constructor + * Authorization in an ExpressRouteCircuit resource. + * + * @member {string} [authorizationKey] The authorization key. + * @member {string} [authorizationUseStatus] AuthorizationUseStatus. Possible + * values are: 'Available' and 'InUse'. Possible values include: 'Available', + * 'InUse' + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRouteCircuitAuthorization extends SubResource { + authorizationKey?: string; + authorizationUseStatus?: string; + provisioningState?: string; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitPeeringConfig class. + * @constructor + * Specifies the peering configuration. + * + * @member {array} [advertisedPublicPrefixes] The reference of + * AdvertisedPublicPrefixes. + * @member {array} [advertisedCommunities] The communities of bgp peering. + * Spepcified for microsoft peering + * @member {string} [advertisedPublicPrefixesState] AdvertisedPublicPrefixState + * of the Peering resource. Possible values are 'NotConfigured', 'Configuring', + * 'Configured', and 'ValidationNeeded'. Possible values include: + * 'NotConfigured', 'Configuring', 'Configured', 'ValidationNeeded' + * @member {number} [legacyMode] The legacy mode of the peering. + * @member {number} [customerASN] The CustomerASN of the peering. + * @member {string} [routingRegistryName] The RoutingRegistryName of the + * configuration. + */ +export interface ExpressRouteCircuitPeeringConfig { + advertisedPublicPrefixes?: string[]; + advertisedCommunities?: string[]; + advertisedPublicPrefixesState?: string; + legacyMode?: number; + customerASN?: number; + routingRegistryName?: string; +} + +/** + * @class + * Initializes a new instance of the RouteFilterRule class. + * @constructor + * Route Filter Rule Resource + * + * @member {string} access The access type of the rule. Valid values are: + * 'Allow', 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} communities The collection for bgp community values to + * filter on. e.g. ['12076:5010','12076:5020'] + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [location] Resource location. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface RouteFilterRule extends SubResource { + access: string; + communities: string[]; + readonly provisioningState?: string; + name?: string; + location?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitStats class. + * @constructor + * Contains stats associated with the peering. + * + * @member {number} [primarybytesIn] Gets BytesIn of the peering. + * @member {number} [primarybytesOut] Gets BytesOut of the peering. + * @member {number} [secondarybytesIn] Gets BytesIn of the peering. + * @member {number} [secondarybytesOut] Gets BytesOut of the peering. + */ +export interface ExpressRouteCircuitStats { + primarybytesIn?: number; + primarybytesOut?: number; + secondarybytesIn?: number; + secondarybytesOut?: number; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitConnection class. + * @constructor + * Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. + * + * @member {object} [expressRouteCircuitPeering] Reference to Express Route + * Circuit Private Peering Resource of the circuit initiating connection. + * @member {string} [expressRouteCircuitPeering.id] Resource ID. + * @member {object} [peerExpressRouteCircuitPeering] Reference to Express Route + * Circuit Private Peering Resource of the peered circuit. + * @member {string} [peerExpressRouteCircuitPeering.id] Resource ID. + * @member {string} [addressPrefix] /29 IP address space to carve out Customer + * addresses for tunnels. + * @member {string} [authorizationKey] The authorization key. + * @member {string} [circuitConnectionStatus] Express Route Circuit Connection + * State. Possible values are: 'Connected' and 'Disconnected'. Possible values + * include: 'Connected', 'Connecting', 'Disconnected' + * @member {string} [provisioningState] Provisioning state of the circuit + * connection resource. Possible values are: 'Succeded', 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRouteCircuitConnection extends SubResource { + expressRouteCircuitPeering?: SubResource; + peerExpressRouteCircuitPeering?: SubResource; + addressPrefix?: string; + authorizationKey?: string; + readonly circuitConnectionStatus?: string; + readonly provisioningState?: string; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitPeering class. + * @constructor + * Peering in an ExpressRouteCircuit resource. + * + * @member {string} [peeringType] The peering type. Possible values include: + * 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + * @member {string} [state] The peering state. Possible values include: + * 'Disabled', 'Enabled' + * @member {number} [azureASN] The Azure ASN. + * @member {number} [peerASN] The peer ASN. + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address prefix. + * @member {string} [primaryAzurePort] The primary port. + * @member {string} [secondaryAzurePort] The secondary port. + * @member {string} [sharedKey] The shared key. + * @member {number} [vlanId] The VLAN ID. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of the + * peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of the + * peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [stats] Gets peering stats. + * @member {number} [stats.primarybytesIn] Gets BytesIn of the peering. + * @member {number} [stats.primarybytesOut] Gets BytesOut of the peering. + * @member {number} [stats.secondarybytesIn] Gets BytesIn of the peering. + * @member {number} [stats.secondarybytesOut] Gets BytesOut of the peering. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [lastModifiedBy] Gets whether the provider or the customer + * last modified the peering. + * @member {object} [routeFilter] The reference of the RouteFilter resource. + * @member {array} [routeFilter.rules] Collection of RouteFilterRules contained + * within a route filter. + * @member {array} [routeFilter.peerings] A collection of references to express + * route circuit peerings. + * @member {string} [routeFilter.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [routeFilter.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {object} [ipv6PeeringConfig] The IPv6 peering configuration. + * @member {string} [ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * @member {string} [ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * @member {object} [ipv6PeeringConfig.microsoftPeeringConfig] The Microsoft + * peering configuration. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [ipv6PeeringConfig.routeFilter] The reference of the + * RouteFilter resource. + * @member {array} [ipv6PeeringConfig.routeFilter.rules] Collection of + * RouteFilterRules contained within a route filter. + * @member {array} [ipv6PeeringConfig.routeFilter.peerings] A collection of + * references to express route circuit peerings. + * @member {string} [ipv6PeeringConfig.routeFilter.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [ipv6PeeringConfig.routeFilter.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {string} [ipv6PeeringConfig.state] The state of peering. Possible + * values are: 'Disabled' and 'Enabled'. Possible values include: 'Disabled', + * 'Enabled' + * @member {array} [connections] The list of circuit connections associated + * with Azure Private Peering for this circuit. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRouteCircuitPeering extends SubResource { + peeringType?: string; + state?: string; + azureASN?: number; + peerASN?: number; + primaryPeerAddressPrefix?: string; + secondaryPeerAddressPrefix?: string; + primaryAzurePort?: string; + secondaryAzurePort?: string; + sharedKey?: string; + vlanId?: number; + microsoftPeeringConfig?: ExpressRouteCircuitPeeringConfig; + stats?: ExpressRouteCircuitStats; + provisioningState?: string; + gatewayManagerEtag?: string; + lastModifiedBy?: string; + routeFilter?: RouteFilter; + ipv6PeeringConfig?: Ipv6ExpressRouteCircuitPeeringConfig; + connections?: ExpressRouteCircuitConnection[]; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the RouteFilter class. + * @constructor + * Route Filter Resource. + * + * @member {array} [rules] Collection of RouteFilterRules contained within a + * route filter. + * @member {array} [peerings] A collection of references to express route + * circuit peerings. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface RouteFilter extends Resource { + rules?: RouteFilterRule[]; + peerings?: ExpressRouteCircuitPeering[]; + readonly provisioningState?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the Ipv6ExpressRouteCircuitPeeringConfig class. + * @constructor + * Contains IPv6 peering config. + * + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address prefix. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of the + * peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of the + * peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [routeFilter] The reference of the RouteFilter resource. + * @member {array} [routeFilter.rules] Collection of RouteFilterRules contained + * within a route filter. + * @member {array} [routeFilter.peerings] A collection of references to express + * route circuit peerings. + * @member {string} [routeFilter.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [routeFilter.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {string} [state] The state of peering. Possible values are: + * 'Disabled' and 'Enabled'. Possible values include: 'Disabled', 'Enabled' + */ +export interface Ipv6ExpressRouteCircuitPeeringConfig { + primaryPeerAddressPrefix?: string; + secondaryPeerAddressPrefix?: string; + microsoftPeeringConfig?: ExpressRouteCircuitPeeringConfig; + routeFilter?: RouteFilter; + state?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitSku class. + * @constructor + * Contains SKU in an ExpressRouteCircuit. + * + * @member {string} [name] The name of the SKU. + * @member {string} [tier] The tier of the SKU. Possible values are 'Standard' + * and 'Premium'. Possible values include: 'Standard', 'Premium' + * @member {string} [family] The family of the SKU. Possible values are: + * 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', + * 'MeteredData' + */ +export interface ExpressRouteCircuitSku { + name?: string; + tier?: string; + family?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitServiceProviderProperties class. + * @constructor + * Contains ServiceProviderProperties in an ExpressRouteCircuit. + * + * @member {string} [serviceProviderName] The serviceProviderName. + * @member {string} [peeringLocation] The peering location. + * @member {number} [bandwidthInMbps] The BandwidthInMbps. + */ +export interface ExpressRouteCircuitServiceProviderProperties { + serviceProviderName?: string; + peeringLocation?: string; + bandwidthInMbps?: number; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuit class. + * @constructor + * ExpressRouteCircuit resource + * + * @member {object} [sku] The SKU. + * @member {string} [sku.name] The name of the SKU. + * @member {string} [sku.tier] The tier of the SKU. Possible values are + * 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * @member {string} [sku.family] The family of the SKU. Possible values are: + * 'UnlimitedData' and 'MeteredData'. Possible values include: 'UnlimitedData', + * 'MeteredData' + * @member {boolean} [allowClassicOperations] Allow classic operations + * @member {string} [circuitProvisioningState] The CircuitProvisioningState + * state of the resource. + * @member {string} [serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * @member {array} [authorizations] The list of authorizations. + * @member {array} [peerings] The list of peerings. + * @member {string} [serviceKey] The ServiceKey. + * @member {string} [serviceProviderNotes] The ServiceProviderNotes. + * @member {object} [serviceProviderProperties] The ServiceProviderProperties. + * @member {string} [serviceProviderProperties.serviceProviderName] The + * serviceProviderName. + * @member {string} [serviceProviderProperties.peeringLocation] The peering + * location. + * @member {number} [serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface ExpressRouteCircuit extends Resource { + sku?: ExpressRouteCircuitSku; + allowClassicOperations?: boolean; + circuitProvisioningState?: string; + serviceProviderProvisioningState?: string; + authorizations?: ExpressRouteCircuitAuthorization[]; + peerings?: ExpressRouteCircuitPeering[]; + serviceKey?: string; + serviceProviderNotes?: string; + serviceProviderProperties?: ExpressRouteCircuitServiceProviderProperties; + provisioningState?: string; + gatewayManagerEtag?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitArpTable class. + * @constructor + * The ARP table associated with the ExpressRouteCircuit. + * + * @member {number} [age] Age + * @member {string} [interfaceProperty] Interface + * @member {string} [ipAddress] The IP address. + * @member {string} [macAddress] The MAC address. + */ +export interface ExpressRouteCircuitArpTable { + age?: number; + interfaceProperty?: string; + ipAddress?: string; + macAddress?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitsArpTableListResult class. + * @constructor + * Response for ListArpTable associated with the Express Route Circuits API. + * + * @member {array} [value] Gets list of the ARP table. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCircuitsArpTableListResult { + value?: ExpressRouteCircuitArpTable[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitRoutesTable class. + * @constructor + * The routes table associated with the ExpressRouteCircuit + * + * @member {string} [network] network + * @member {string} [nextHop] nextHop + * @member {string} [locPrf] locPrf + * @member {number} [weight] weight. + * @member {string} [path] path + */ +export interface ExpressRouteCircuitRoutesTable { + network?: string; + nextHop?: string; + locPrf?: string; + weight?: number; + path?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitsRoutesTableListResult class. + * @constructor + * Response for ListRoutesTable associated with the Express Route Circuits API. + * + * @member {array} [value] The list of routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCircuitsRoutesTableListResult { + value?: ExpressRouteCircuitRoutesTable[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitRoutesTableSummary class. + * @constructor + * The routes table associated with the ExpressRouteCircuit. + * + * @member {string} [neighbor] Neighbor + * @member {number} [v] BGP version number spoken to the neighbor. + * @member {number} [as] Autonomous system number. + * @member {string} [upDown] The length of time that the BGP session has been + * in the Established state, or the current status if not in the Established + * state. + * @member {string} [statePfxRcd] Current state of the BGP session, and the + * number of prefixes that have been received from a neighbor or peer group. + */ +export interface ExpressRouteCircuitRoutesTableSummary { + neighbor?: string; + v?: number; + as?: number; + upDown?: string; + statePfxRcd?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitsRoutesTableSummaryListResult class. + * @constructor + * Response for ListRoutesTable associated with the Express Route Circuits API. + * + * @member {array} [value] A list of the routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCircuitsRoutesTableSummaryListResult { + value?: ExpressRouteCircuitRoutesTableSummary[]; + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteServiceProviderBandwidthsOffered class. + * @constructor + * Contains bandwidths offered in ExpressRouteServiceProvider resources. + * + * @member {string} [offerName] The OfferName. + * @member {number} [valueInMbps] The ValueInMbps. + */ +export interface ExpressRouteServiceProviderBandwidthsOffered { + offerName?: string; + valueInMbps?: number; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteServiceProvider class. + * @constructor + * A ExpressRouteResourceProvider object. + * + * @member {array} [peeringLocations] Get a list of peering locations. + * @member {array} [bandwidthsOffered] Gets bandwidths offered. + * @member {string} [provisioningState] Gets the provisioning state of the + * resource. + */ +export interface ExpressRouteServiceProvider extends Resource { + peeringLocations?: string[]; + bandwidthsOffered?: ExpressRouteServiceProviderBandwidthsOffered[]; + provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnectionRoutesTableSummary class. + * @constructor + * The routes table associated with the ExpressRouteCircuit. + * + * @member {string} [neighbor] IP address of Neighbor router + * @member {number} [asn] Autonomous system number. + * @member {string} [upDown] The length of time that the BGP session has been + * in the Established state, or the current status if not in the Established + * state. + * @member {string} [stateOrPrefixesReceived] Current state of the BGP session, + * and the number of prefixes that have been received from a neighbor or peer + * group. + */ +export interface ExpressRouteCrossConnectionRoutesTableSummary { + neighbor?: string; + asn?: number; + upDown?: string; + stateOrPrefixesReceived?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnectionsRoutesTableSummaryListResult class. + * @constructor + * Response for ListRoutesTable associated with the Express Route Cross + * Connections. + * + * @member {array} [value] A list of the routes table. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCrossConnectionsRoutesTableSummaryListResult { + value?: ExpressRouteCrossConnectionRoutesTableSummary[]; + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitReference class. + * @constructor + * @member {string} [id] Corresponding Express Route Circuit Id. + */ +export interface ExpressRouteCircuitReference { + id?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnectionPeering class. + * @constructor + * Peering in an ExpressRoute Cross Connection resource. + * + * @member {string} [peeringType] The peering type. Possible values include: + * 'AzurePublicPeering', 'AzurePrivatePeering', 'MicrosoftPeering' + * @member {string} [state] The peering state. Possible values include: + * 'Disabled', 'Enabled' + * @member {number} [azureASN] The Azure ASN. + * @member {number} [peerASN] The peer ASN. + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address prefix. + * @member {string} [primaryAzurePort] The primary port. + * @member {string} [secondaryAzurePort] The secondary port. + * @member {string} [sharedKey] The shared key. + * @member {number} [vlanId] The VLAN ID. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of the + * peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of the + * peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [gatewayManagerEtag] The GatewayManager Etag. + * @member {string} [lastModifiedBy] Gets whether the provider or the customer + * last modified the peering. + * @member {object} [ipv6PeeringConfig] The IPv6 peering configuration. + * @member {string} [ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * @member {string} [ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * @member {object} [ipv6PeeringConfig.microsoftPeeringConfig] The Microsoft + * peering configuration. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * @member {number} [ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * @member {string} + * [ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [ipv6PeeringConfig.routeFilter] The reference of the + * RouteFilter resource. + * @member {array} [ipv6PeeringConfig.routeFilter.rules] Collection of + * RouteFilterRules contained within a route filter. + * @member {array} [ipv6PeeringConfig.routeFilter.peerings] A collection of + * references to express route circuit peerings. + * @member {string} [ipv6PeeringConfig.routeFilter.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [ipv6PeeringConfig.routeFilter.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {string} [ipv6PeeringConfig.state] The state of peering. Possible + * values are: 'Disabled' and 'Enabled'. Possible values include: 'Disabled', + * 'Enabled' + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface ExpressRouteCrossConnectionPeering extends SubResource { + peeringType?: string; + state?: string; + readonly azureASN?: number; + peerASN?: number; + primaryPeerAddressPrefix?: string; + secondaryPeerAddressPrefix?: string; + readonly primaryAzurePort?: string; + readonly secondaryAzurePort?: string; + sharedKey?: string; + vlanId?: number; + microsoftPeeringConfig?: ExpressRouteCircuitPeeringConfig; + readonly provisioningState?: string; + readonly gatewayManagerEtag?: string; + lastModifiedBy?: string; + ipv6PeeringConfig?: Ipv6ExpressRouteCircuitPeeringConfig; + name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnection class. + * @constructor + * ExpressRouteCrossConnection resource + * + * @member {string} [primaryAzurePort] The name of the primary port. + * @member {string} [secondaryAzurePort] The name of the secondary port. + * @member {number} [sTag] The identifier of the circuit traffic. + * @member {string} [peeringLocation] The peering location of the ExpressRoute + * circuit. + * @member {number} [bandwidthInMbps] The circuit bandwidth In Mbps. + * @member {object} [expressRouteCircuit] The ExpressRouteCircuit + * @member {string} [expressRouteCircuit.id] Corresponding Express Route + * Circuit Id. + * @member {string} [serviceProviderProvisioningState] The provisioning state + * of the circuit in the connectivity provider system. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned'. Possible values include: + * 'NotProvisioned', 'Provisioning', 'Provisioned', 'Deprovisioning' + * @member {string} [serviceProviderNotes] Additional read only notes set by + * the connectivity provider. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {array} [peerings] The list of peerings. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface ExpressRouteCrossConnection extends Resource { + readonly primaryAzurePort?: string; + readonly secondaryAzurePort?: string; + readonly sTag?: number; + readonly peeringLocation?: string; + readonly bandwidthInMbps?: number; + readonly expressRouteCircuit?: ExpressRouteCircuitReference; + serviceProviderProvisioningState?: string; + serviceProviderNotes?: string; + readonly provisioningState?: string; + peerings?: ExpressRouteCrossConnectionPeering[]; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerSku class. + * @constructor + * SKU of a load balancer + * + * @member {string} [name] Name of a load balancer SKU. Possible values + * include: 'Basic', 'Standard' + */ +export interface LoadBalancerSku { + name?: string; +} + +/** + * @class + * Initializes a new instance of the FrontendIPConfiguration class. + * @constructor + * Frontend IP address of the load balancer. + * + * @member {array} [inboundNatRules] Read only. Inbound rules URIs that use + * this frontend IP. + * @member {array} [inboundNatPools] Read only. Inbound pools URIs that use + * this frontend IP. + * @member {array} [outboundNatRules] Read only. Outbound rules URIs that use + * this frontend IP. + * @member {array} [loadBalancingRules] Gets load balancing rules URIs that use + * this frontend IP. + * @member {string} [privateIPAddress] The private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] The Private IP allocation + * method. Possible values are: 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A collection + * of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. True + * means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to the + * network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of references + * to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {object} [publicIPAddress] The reference of the Public IP resource. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAllocationMethod] + * The private IP allocation method. Possible values are 'Static' and + * 'Dynamic'. Possible values include: 'Static', 'Dynamic' + * @member {object} [publicIPAddress.ipConfiguration.subnet] The reference of + * the subnet resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.addressPrefix] The + * address prefix for the subnet. + * @member {object} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] The reference + * of the NetworkSecurityGroup resource. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.subnets] + * A collection of references to subnets. + * @member {boolean} + * [publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} [publicIPAddress.ipConfiguration.subnet.serviceEndpoints] An + * array of service endpoints. + * @member {array} [publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations using + * subnet. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [publicIPAddress.ipConfiguration.subnet.provisioningState] + * The provisioning state of the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} [publicIPAddress.ipConfiguration.provisioningState] Gets + * the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [publicIPAddress.ipConfiguration.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or sets + * the Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated with + * the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout of + * the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {array} [zones] A list of availability zones denoting the IP + * allocated for the resource needs to come from. + */ +export interface FrontendIPConfiguration extends SubResource { + readonly inboundNatRules?: SubResource[]; + readonly inboundNatPools?: SubResource[]; + readonly outboundNatRules?: SubResource[]; + readonly loadBalancingRules?: SubResource[]; + privateIPAddress?: string; + privateIPAllocationMethod?: string; + subnet?: Subnet; + publicIPAddress?: PublicIPAddress; + provisioningState?: string; + name?: string; + etag?: string; + zones?: string[]; +} + +/** + * @class + * Initializes a new instance of the LoadBalancingRule class. + * @constructor + * A load balancing rule for a load balancer. + * + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [backendAddressPool] A reference to a pool of DIPs. Inbound + * traffic is randomly load balanced across IPs in the backend IPs. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [probe] The reference of the load balancer probe used by + * the load balancing rule. + * @member {string} [probe.id] Resource ID. + * @member {string} protocol Possible values include: 'Udp', 'Tcp', 'All' + * @member {string} [loadDistribution] The load distribution policy for this + * rule. Possible values are 'Default', 'SourceIP', and 'SourceIPProtocol'. + * Possible values include: 'Default', 'SourceIP', 'SourceIPProtocol' + * @member {number} frontendPort The port for the external endpoint. Port + * numbers for each rule must be unique within the Load Balancer. Acceptable + * values are between 0 and 65534. Note that value 0 enables "Any Port" + * @member {number} [backendPort] The port used for internal connections on the + * endpoint. Acceptable values are between 0 and 65535. Note that value 0 + * enables "Any Port" + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default value + * is 4 minutes. This element is only used when the protocol is set to TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's endpoint + * for the floating IP capability required to configure a SQL AlwaysOn + * Availability Group. This setting is required when using the SQL AlwaysOn + * Availability Groups in SQL server. This setting can't be changed after you + * create the endpoint. + * @member {boolean} [disableOutboundSnat] Configures SNAT for the VMs in the + * backend pool to use the publicIP address specified in the frontend of the + * load balancing rule. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface LoadBalancingRule extends SubResource { + frontendIPConfiguration?: SubResource; + backendAddressPool?: SubResource; + probe?: SubResource; + protocol: string; + loadDistribution?: string; + frontendPort: number; + backendPort?: number; + idleTimeoutInMinutes?: number; + enableFloatingIP?: boolean; + disableOutboundSnat?: boolean; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the Probe class. + * @constructor + * A load balancer probe. + * + * @member {array} [loadBalancingRules] The load balancer rules that use this + * probe. + * @member {string} protocol The protocol of the end point. Possible values + * are: 'Http' or 'Tcp'. If 'Tcp' is specified, a received ACK is required for + * the probe to be successful. If 'Http' is specified, a 200 OK response from + * the specifies URI is required for the probe to be successful. Possible + * values include: 'Http', 'Tcp' + * @member {number} port The port for communicating the probe. Possible values + * range from 1 to 65535, inclusive. + * @member {number} [intervalInSeconds] The interval, in seconds, for how + * frequently to probe the endpoint for health status. Typically, the interval + * is slightly less than half the allocated timeout period (in seconds) which + * allows two full probes before taking the instance out of rotation. The + * default value is 15, the minimum value is 5. + * @member {number} [numberOfProbes] The number of probes where if no response, + * will result in stopping further traffic from being delivered to the + * endpoint. This values allows endpoints to be taken out of rotation faster or + * slower than the typical times used in Azure. + * @member {string} [requestPath] The URI used for requesting health status + * from the VM. Path is required if a protocol is set to http. Otherwise, it is + * not allowed. There is no default value. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface Probe extends SubResource { + readonly loadBalancingRules?: SubResource[]; + protocol: string; + port: number; + intervalInSeconds?: number; + numberOfProbes?: number; + requestPath?: string; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the InboundNatPool class. + * @constructor + * Inbound NAT pool of the load balancer. + * + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {string} protocol Possible values include: 'Udp', 'Tcp', 'All' + * @member {number} frontendPortRangeStart The first port number in the range + * of external ports that will be used to provide Inbound Nat to NICs + * associated with a load balancer. Acceptable values range between 1 and + * 65534. + * @member {number} frontendPortRangeEnd The last port number in the range of + * external ports that will be used to provide Inbound Nat to NICs associated + * with a load balancer. Acceptable values range between 1 and 65535. + * @member {number} backendPort The port used for internal connections on the + * endpoint. Acceptable values are between 1 and 65535. + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default value + * is 4 minutes. This element is only used when the protocol is set to TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's endpoint + * for the floating IP capability required to configure a SQL AlwaysOn + * Availability Group. This setting is required when using the SQL AlwaysOn + * Availability Groups in SQL server. This setting can't be changed after you + * create the endpoint. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface InboundNatPool extends SubResource { + frontendIPConfiguration?: SubResource; + protocol: string; + frontendPortRangeStart: number; + frontendPortRangeEnd: number; + backendPort: number; + idleTimeoutInMinutes?: number; + enableFloatingIP?: boolean; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the OutboundNatRule class. + * @constructor + * Outbound NAT pool of the load balancer. + * + * @member {number} [allocatedOutboundPorts] The number of outbound ports to be + * used for NAT. + * @member {array} [frontendIPConfigurations] The Frontend IP addresses of the + * load balancer. + * @member {object} backendAddressPool A reference to a pool of DIPs. Outbound + * traffic is randomly load balanced across IPs in the backend IPs. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface OutboundNatRule extends SubResource { + allocatedOutboundPorts?: number; + frontendIPConfigurations?: SubResource[]; + backendAddressPool: SubResource; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancer class. + * @constructor + * LoadBalancer resource + * + * @member {object} [sku] The load balancer SKU. + * @member {string} [sku.name] Name of a load balancer SKU. Possible values + * include: 'Basic', 'Standard' + * @member {array} [frontendIPConfigurations] Object representing the frontend + * IPs to be used for the load balancer + * @member {array} [backendAddressPools] Collection of backend address pools + * used by a load balancer + * @member {array} [loadBalancingRules] Object collection representing the load + * balancing rules Gets the provisioning + * @member {array} [probes] Collection of probe objects used in the load + * balancer + * @member {array} [inboundNatRules] Collection of inbound NAT Rules used by a + * load balancer. Defining inbound NAT rules on your load balancer is mutually + * exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * @member {array} [inboundNatPools] Defines an external port range for inbound + * NAT to a single backend port on NICs associated with a load balancer. + * Inbound NAT rules are created automatically for each NIC associated with the + * Load Balancer using an external port from this range. Defining an Inbound + * NAT pool on your Load Balancer is mutually exclusive with defining inbound + * Nat rules. Inbound NAT pools are referenced from virtual machine scale sets. + * NICs that are associated with individual virtual machines cannot reference + * an inbound NAT pool. They have to reference individual inbound NAT rules. + * @member {array} [outboundNatRules] The outbound NAT rules. + * @member {string} [resourceGuid] The resource GUID property of the load + * balancer resource. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface LoadBalancer extends Resource { + sku?: LoadBalancerSku; + frontendIPConfigurations?: FrontendIPConfiguration[]; + backendAddressPools?: BackendAddressPool[]; + loadBalancingRules?: LoadBalancingRule[]; + probes?: Probe[]; + inboundNatRules?: InboundNatRule[]; + inboundNatPools?: InboundNatPool[]; + outboundNatRules?: OutboundNatRule[]; + resourceGuid?: string; + provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorDetails class. + * @constructor + * @member {string} [code] + * @member {string} [target] + * @member {string} [message] + */ +export interface ErrorDetails { + code?: string; + target?: string; + message?: string; +} + +/** + * @class + * Initializes a new instance of the ErrorModel class. + * @constructor + * @member {string} [code] + * @member {string} [message] + * @member {string} [target] + * @member {array} [details] + * @member {string} [innerError] + */ +export interface ErrorModel { + code?: string; + message?: string; + target?: string; + details?: ErrorDetails[]; + innerError?: string; +} + +/** + * @class + * Initializes a new instance of the AzureAsyncOperationResult class. + * @constructor + * The response body contains the status of the specified asynchronous + * operation, indicating whether it has succeeded, is in progress, or has + * failed. Note that this status is distinct from the HTTP status code returned + * for the Get Operation Status operation itself. If the asynchronous operation + * succeeded, the response body includes the HTTP status code for the + * successful request. If the asynchronous operation failed, the response body + * includes the HTTP status code for the failed request and error information + * regarding the failure. + * + * @member {string} [status] Status of the Azure async operation. Possible + * values are: 'InProgress', 'Succeeded', and 'Failed'. Possible values + * include: 'InProgress', 'Succeeded', 'Failed' + * @member {object} [error] + * @member {string} [error.code] + * @member {string} [error.message] + * @member {string} [error.target] + * @member {array} [error.details] + * @member {string} [error.innerError] + */ +export interface AzureAsyncOperationResult { + status?: string; + error?: ErrorModel; +} + +/** + * @class + * Initializes a new instance of the EffectiveNetworkSecurityGroupAssociation class. + * @constructor + * The effective network security group association. + * + * @member {object} [subnet] The ID of the subnet if assigned. + * @member {string} [subnet.id] Resource ID. + * @member {object} [networkInterface] The ID of the network interface if + * assigned. + * @member {string} [networkInterface.id] Resource ID. + */ +export interface EffectiveNetworkSecurityGroupAssociation { + subnet?: SubResource; + networkInterface?: SubResource; +} + +/** + * @class + * Initializes a new instance of the EffectiveNetworkSecurityRule class. + * @constructor + * Effective network security rules. + * + * @member {string} [name] The name of the security rule specified by the user + * (if created by the user). + * @member {string} [protocol] The network protocol this rule applies to. + * Possible values are: 'Tcp', 'Udp', and 'All'. Possible values include: + * 'Tcp', 'Udp', 'All' + * @member {string} [sourcePortRange] The source port or range. + * @member {string} [destinationPortRange] The destination port or range. + * @member {array} [sourcePortRanges] The source port ranges. Expected values + * include a single integer between 0 and 65535, a range using '-' as seperator + * (e.g. 100-400), or an asterix (*) + * @member {array} [destinationPortRanges] The destination port ranges. + * Expected values include a single integer between 0 and 65535, a range using + * '-' as seperator (e.g. 100-400), or an asterix (*) + * @member {string} [sourceAddressPrefix] The source address prefix. + * @member {string} [destinationAddressPrefix] The destination address prefix. + * @member {array} [sourceAddressPrefixes] The source address prefixes. + * Expected values include CIDR IP ranges, Default Tags (VirtualNetwork, + * AureLoadBalancer, Internet), System Tags, and the asterix (*). + * @member {array} [destinationAddressPrefixes] The destination address + * prefixes. Expected values include CIDR IP ranges, Default Tags + * (VirtualNetwork, AureLoadBalancer, Internet), System Tags, and the asterix + * (*). + * @member {array} [expandedSourceAddressPrefix] The expanded source address + * prefix. + * @member {array} [expandedDestinationAddressPrefix] Expanded destination + * address prefix. + * @member {string} [access] Whether network traffic is allowed or denied. + * Possible values are: 'Allow' and 'Deny'. Possible values include: 'Allow', + * 'Deny' + * @member {number} [priority] The priority of the rule. + * @member {string} [direction] The direction of the rule. Possible values are: + * 'Inbound and Outbound'. Possible values include: 'Inbound', 'Outbound' + */ +export interface EffectiveNetworkSecurityRule { + name?: string; + protocol?: string; + sourcePortRange?: string; + destinationPortRange?: string; + sourcePortRanges?: string[]; + destinationPortRanges?: string[]; + sourceAddressPrefix?: string; + destinationAddressPrefix?: string; + sourceAddressPrefixes?: string[]; + destinationAddressPrefixes?: string[]; + expandedSourceAddressPrefix?: string[]; + expandedDestinationAddressPrefix?: string[]; + access?: string; + priority?: number; + direction?: string; +} + +/** + * @class + * Initializes a new instance of the EffectiveNetworkSecurityGroup class. + * @constructor + * Effective network security group. + * + * @member {object} [networkSecurityGroup] The ID of network security group + * that is applied. + * @member {string} [networkSecurityGroup.id] Resource ID. + * @member {object} [association] Associated resources. + * @member {object} [association.subnet] The ID of the subnet if assigned. + * @member {string} [association.subnet.id] Resource ID. + * @member {object} [association.networkInterface] The ID of the network + * interface if assigned. + * @member {string} [association.networkInterface.id] Resource ID. + * @member {array} [effectiveSecurityRules] A collection of effective security + * rules. + * @member {object} [tagMap] Mapping of tags to list of IP Addresses included + * within the tag. + */ +export interface EffectiveNetworkSecurityGroup { + networkSecurityGroup?: SubResource; + association?: EffectiveNetworkSecurityGroupAssociation; + effectiveSecurityRules?: EffectiveNetworkSecurityRule[]; + tagMap?: { [propertyName: string]: string[] }; +} + +/** + * @class + * Initializes a new instance of the EffectiveNetworkSecurityGroupListResult class. + * @constructor + * Response for list effective network security groups API service call. + * + * @member {array} [value] A list of effective network security groups. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface EffectiveNetworkSecurityGroupListResult { + value?: EffectiveNetworkSecurityGroup[]; + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EffectiveRoute class. + * @constructor + * Effective Route + * + * @member {string} [name] The name of the user defined route. This is + * optional. + * @member {string} [source] Who created the route. Possible values are: + * 'Unknown', 'User', 'VirtualNetworkGateway', and 'Default'. Possible values + * include: 'Unknown', 'User', 'VirtualNetworkGateway', 'Default' + * @member {string} [state] The value of effective route. Possible values are: + * 'Active' and 'Invalid'. Possible values include: 'Active', 'Invalid' + * @member {array} [addressPrefix] The address prefixes of the effective routes + * in CIDR notation. + * @member {array} [nextHopIpAddress] The IP address of the next hop of the + * effective route. + * @member {string} [nextHopType] The type of Azure hop the packet should be + * sent to. Possible values are: 'VirtualNetworkGateway', 'VnetLocal', + * 'Internet', 'VirtualAppliance', and 'None'. Possible values include: + * 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', 'None' + */ +export interface EffectiveRoute { + name?: string; + source?: string; + state?: string; + addressPrefix?: string[]; + nextHopIpAddress?: string[]; + nextHopType?: string; +} + +/** + * @class + * Initializes a new instance of the EffectiveRouteListResult class. + * @constructor + * Response for list effective route API service call. + * + * @member {array} [value] A list of effective routes. + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface EffectiveRouteListResult { + value?: EffectiveRoute[]; + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkWatcher class. + * @constructor + * Network watcher in a resource group. + * + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + */ +export interface NetworkWatcher extends Resource { + etag?: string; + readonly provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the TopologyParameters class. + * @constructor + * Parameters that define the representation of topology. + * + * @member {string} [targetResourceGroupName] The name of the target resource + * group to perform topology on. + * @member {object} [targetVirtualNetwork] The reference of the Virtual Network + * resource. + * @member {string} [targetVirtualNetwork.id] Resource ID. + * @member {object} [targetSubnet] The reference of the Subnet resource. + * @member {string} [targetSubnet.id] Resource ID. + */ +export interface TopologyParameters { + targetResourceGroupName?: string; + targetVirtualNetwork?: SubResource; + targetSubnet?: SubResource; +} + +/** + * @class + * Initializes a new instance of the TopologyAssociation class. + * @constructor + * Resources that have an association with the parent resource. + * + * @member {string} [name] The name of the resource that is associated with the + * parent resource. + * @member {string} [resourceId] The ID of the resource that is associated with + * the parent resource. + * @member {string} [associationType] The association type of the child + * resource to the parent resource. Possible values include: 'Associated', + * 'Contains' + */ +export interface TopologyAssociation { + name?: string; + resourceId?: string; + associationType?: string; +} + +/** + * @class + * Initializes a new instance of the TopologyResource class. + * @constructor + * The network resource topology information for the given resource group. + * + * @member {string} [name] Name of the resource. + * @member {string} [id] ID of the resource. + * @member {string} [location] Resource location. + * @member {array} [associations] Holds the associations the resource has with + * other resources in the resource group. + */ +export interface TopologyResource { + name?: string; + id?: string; + location?: string; + associations?: TopologyAssociation[]; +} + +/** + * @class + * Initializes a new instance of the Topology class. + * @constructor + * Topology of the specified resource group. + * + * @member {string} [id] GUID representing the operation id. + * @member {date} [createdDateTime] The datetime when the topology was + * initially created for the resource group. + * @member {date} [lastModified] The datetime when the topology was last + * modified. + * @member {array} [resources] + */ +export interface Topology { + readonly id?: string; + readonly createdDateTime?: Date; + readonly lastModified?: Date; + resources?: TopologyResource[]; +} + +/** + * @class + * Initializes a new instance of the VerificationIPFlowParameters class. + * @constructor + * Parameters that define the IP flow to be verified. + * + * @member {string} targetResourceId The ID of the target resource to perform + * next-hop on. + * @member {string} direction The direction of the packet represented as a + * 5-tuple. Possible values include: 'Inbound', 'Outbound' + * @member {string} protocol Protocol to be verified on. Possible values + * include: 'TCP', 'UDP' + * @member {string} localPort The local port. Acceptable values are a single + * integer in the range (0-65535). Support for * for the source port, which + * depends on the direction. + * @member {string} remotePort The remote port. Acceptable values are a single + * integer in the range (0-65535). Support for * for the source port, which + * depends on the direction. + * @member {string} localIPAddress The local IP address. Acceptable values are + * valid IPv4 addresses. + * @member {string} remoteIPAddress The remote IP address. Acceptable values + * are valid IPv4 addresses. + * @member {string} [targetNicResourceId] The NIC ID. (If VM has multiple NICs + * and IP forwarding is enabled on any of them, then this parameter must be + * specified. Otherwise optional). + */ +export interface VerificationIPFlowParameters { + targetResourceId: string; + direction: string; + protocol: string; + localPort: string; + remotePort: string; + localIPAddress: string; + remoteIPAddress: string; + targetNicResourceId?: string; +} + +/** + * @class + * Initializes a new instance of the VerificationIPFlowResult class. + * @constructor + * Results of IP flow verification on the target resource. + * + * @member {string} [access] Indicates whether the traffic is allowed or + * denied. Possible values include: 'Allow', 'Deny' + * @member {string} [ruleName] Name of the rule. If input is not matched + * against any security rule, it is not displayed. + */ +export interface VerificationIPFlowResult { + access?: string; + ruleName?: string; +} + +/** + * @class + * Initializes a new instance of the NextHopParameters class. + * @constructor + * Parameters that define the source and destination endpoint. + * + * @member {string} targetResourceId The resource identifier of the target + * resource against which the action is to be performed. + * @member {string} sourceIPAddress The source IP address. + * @member {string} destinationIPAddress The destination IP address. + * @member {string} [targetNicResourceId] The NIC ID. (If VM has multiple NICs + * and IP forwarding is enabled on any of the nics, then this parameter must be + * specified. Otherwise optional). + */ +export interface NextHopParameters { + targetResourceId: string; + sourceIPAddress: string; + destinationIPAddress: string; + targetNicResourceId?: string; +} + +/** + * @class + * Initializes a new instance of the NextHopResult class. + * @constructor + * The information about next hop from the specified VM. + * + * @member {string} [nextHopType] Next hop type. Possible values include: + * 'Internet', 'VirtualAppliance', 'VirtualNetworkGateway', 'VnetLocal', + * 'HyperNetGateway', 'None' + * @member {string} [nextHopIpAddress] Next hop IP Address + * @member {string} [routeTableId] The resource identifier for the route table + * associated with the route being returned. If the route being returned does + * not correspond to any user created routes then this field will be the string + * 'System Route'. + */ +export interface NextHopResult { + nextHopType?: string; + nextHopIpAddress?: string; + routeTableId?: string; +} + +/** + * @class + * Initializes a new instance of the SecurityGroupViewParameters class. + * @constructor + * Parameters that define the VM to check security groups for. + * + * @member {string} targetResourceId ID of the target VM. + */ +export interface SecurityGroupViewParameters { + targetResourceId: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceAssociation class. + * @constructor + * Network interface and its custom security rules. + * + * @member {string} [id] Network interface ID. + * @member {array} [securityRules] Collection of custom security rules. + */ +export interface NetworkInterfaceAssociation { + readonly id?: string; + securityRules?: SecurityRule[]; +} + +/** + * @class + * Initializes a new instance of the SubnetAssociation class. + * @constructor + * Network interface and its custom security rules. + * + * @member {string} [id] Subnet ID. + * @member {array} [securityRules] Collection of custom security rules. + */ +export interface SubnetAssociation { + readonly id?: string; + securityRules?: SecurityRule[]; +} + +/** + * @class + * Initializes a new instance of the SecurityRuleAssociations class. + * @constructor + * All security rules associated with the network interface. + * + * @member {object} [networkInterfaceAssociation] + * @member {string} [networkInterfaceAssociation.id] Network interface ID. + * @member {array} [networkInterfaceAssociation.securityRules] Collection of + * custom security rules. + * @member {object} [subnetAssociation] + * @member {string} [subnetAssociation.id] Subnet ID. + * @member {array} [subnetAssociation.securityRules] Collection of custom + * security rules. + * @member {array} [defaultSecurityRules] Collection of default security rules + * of the network security group. + * @member {array} [effectiveSecurityRules] Collection of effective security + * rules. + */ +export interface SecurityRuleAssociations { + networkInterfaceAssociation?: NetworkInterfaceAssociation; + subnetAssociation?: SubnetAssociation; + defaultSecurityRules?: SecurityRule[]; + effectiveSecurityRules?: EffectiveNetworkSecurityRule[]; +} + +/** + * @class + * Initializes a new instance of the SecurityGroupNetworkInterface class. + * @constructor + * Network interface and all its associated security rules. + * + * @member {string} [id] ID of the network interface. + * @member {object} [securityRuleAssociations] + * @member {object} [securityRuleAssociations.networkInterfaceAssociation] + * @member {string} [securityRuleAssociations.networkInterfaceAssociation.id] + * Network interface ID. + * @member {array} + * [securityRuleAssociations.networkInterfaceAssociation.securityRules] + * Collection of custom security rules. + * @member {object} [securityRuleAssociations.subnetAssociation] + * @member {string} [securityRuleAssociations.subnetAssociation.id] Subnet ID. + * @member {array} [securityRuleAssociations.subnetAssociation.securityRules] + * Collection of custom security rules. + * @member {array} [securityRuleAssociations.defaultSecurityRules] Collection + * of default security rules of the network security group. + * @member {array} [securityRuleAssociations.effectiveSecurityRules] Collection + * of effective security rules. + */ +export interface SecurityGroupNetworkInterface { + id?: string; + securityRuleAssociations?: SecurityRuleAssociations; +} + +/** + * @class + * Initializes a new instance of the SecurityGroupViewResult class. + * @constructor + * The information about security rules applied to the specified VM. + * + * @member {array} [networkInterfaces] List of network interfaces on the + * specified VM. + */ +export interface SecurityGroupViewResult { + networkInterfaces?: SecurityGroupNetworkInterface[]; +} + +/** + * @class + * Initializes a new instance of the PacketCaptureStorageLocation class. + * @constructor + * Describes the storage location for a packet capture session. + * + * @member {string} [storageId] The ID of the storage account to save the + * packet capture session. Required if no local file path is provided. + * @member {string} [storagePath] The URI of the storage path to save the + * packet capture. Must be a well-formed URI describing the location to save + * the packet capture. + * @member {string} [filePath] A valid local path on the targeting VM. Must + * include the name of the capture file (*.cap). For linux virtual machine it + * must start with /var/captures. Required if no storage ID is provided, + * otherwise optional. + */ +export interface PacketCaptureStorageLocation { + storageId?: string; + storagePath?: string; + filePath?: string; +} + +/** + * @class + * Initializes a new instance of the PacketCaptureFilter class. + * @constructor + * Filter that is applied to packet capture request. Multiple filters can be + * applied. + * + * @member {string} [protocol] Protocol to be filtered on. Possible values + * include: 'TCP', 'UDP', 'Any'. Default value: 'Any' . + * @member {string} [localIPAddress] Local IP Address to be filtered on. + * Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for + * range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges not + * currently supported. Mixing ranges with multiple entries not currently + * supported. Default = null. + * @member {string} [remoteIPAddress] Local IP Address to be filtered on. + * Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" for + * range. "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges not + * currently supported. Mixing ranges with multiple entries not currently + * supported. Default = null. + * @member {string} [localPort] Local port to be filtered on. Notation: "80" + * for single port entry."80-85" for range. "80;443;" for multiple entries. + * Multiple ranges not currently supported. Mixing ranges with multiple entries + * not currently supported. Default = null. + * @member {string} [remotePort] Remote port to be filtered on. Notation: "80" + * for single port entry."80-85" for range. "80;443;" for multiple entries. + * Multiple ranges not currently supported. Mixing ranges with multiple entries + * not currently supported. Default = null. + */ +export interface PacketCaptureFilter { + protocol?: string; + localIPAddress?: string; + remoteIPAddress?: string; + localPort?: string; + remotePort?: string; +} + +/** + * @class + * Initializes a new instance of the PacketCaptureParameters class. + * @constructor + * Parameters that define the create packet capture operation. + * + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture output. + * Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage ID + * is provided, otherwise optional. + * @member {array} [filters] + */ +export interface PacketCaptureParameters { + target: string; + bytesToCapturePerPacket?: number; + totalBytesPerSession?: number; + timeLimitInSeconds?: number; + storageLocation: PacketCaptureStorageLocation; + filters?: PacketCaptureFilter[]; +} + +/** + * @class + * Initializes a new instance of the PacketCapture class. + * @constructor + * Parameters that define the create packet capture operation. + * + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture output. + * Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage ID + * is provided, otherwise optional. + * @member {array} [filters] + */ +export interface PacketCapture { + target: string; + bytesToCapturePerPacket?: number; + totalBytesPerSession?: number; + timeLimitInSeconds?: number; + storageLocation: PacketCaptureStorageLocation; + filters?: PacketCaptureFilter[]; +} + +/** + * @class + * Initializes a new instance of the PacketCaptureResult class. + * @constructor + * Information about packet capture session. + * + * @member {string} [name] Name of the packet capture session. + * @member {string} [id] ID of the packet capture operation. + * @member {string} [etag] Default value: 'A unique read-only string that + * changes whenever the resource is updated.' . + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture output. + * Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage ID + * is provided, otherwise optional. + * @member {array} [filters] + * @member {string} [provisioningState] The provisioning state of the packet + * capture session. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + */ +export interface PacketCaptureResult { + readonly name?: string; + readonly id?: string; + etag?: string; + target: string; + bytesToCapturePerPacket?: number; + totalBytesPerSession?: number; + timeLimitInSeconds?: number; + storageLocation: PacketCaptureStorageLocation; + filters?: PacketCaptureFilter[]; + provisioningState?: string; +} + +/** + * @class + * Initializes a new instance of the PacketCaptureQueryStatusResult class. + * @constructor + * Status of packet capture session. + * + * @member {string} [name] The name of the packet capture resource. + * @member {string} [id] The ID of the packet capture resource. + * @member {date} [captureStartTime] The start time of the packet capture + * session. + * @member {string} [packetCaptureStatus] The status of the packet capture + * session. Possible values include: 'NotStarted', 'Running', 'Stopped', + * 'Error', 'Unknown' + * @member {string} [stopReason] The reason the current packet capture session + * was stopped. + * @member {array} [packetCaptureError] List of errors of packet capture + * session. + */ +export interface PacketCaptureQueryStatusResult { + name?: string; + id?: string; + captureStartTime?: Date; + packetCaptureStatus?: string; + stopReason?: string; + packetCaptureError?: string[]; +} + +/** + * @class + * Initializes a new instance of the TroubleshootingParameters class. + * @constructor + * Parameters that define the resource to troubleshoot. + * + * @member {string} targetResourceId The target resource to troubleshoot. + * @member {string} storageId The ID for the storage account to save the + * troubleshoot result. + * @member {string} storagePath The path to the blob to save the troubleshoot + * result in. + */ +export interface TroubleshootingParameters { + targetResourceId: string; + storageId: string; + storagePath: string; +} + +/** + * @class + * Initializes a new instance of the QueryTroubleshootingParameters class. + * @constructor + * Parameters that define the resource to query the troubleshooting result. + * + * @member {string} targetResourceId The target resource ID to query the + * troubleshooting result. + */ +export interface QueryTroubleshootingParameters { + targetResourceId: string; +} + +/** + * @class + * Initializes a new instance of the TroubleshootingRecommendedActions class. + * @constructor + * Recommended actions based on discovered issues. + * + * @member {string} [actionId] ID of the recommended action. + * @member {string} [actionText] Description of recommended actions. + * @member {string} [actionUri] The uri linking to a documentation for the + * recommended troubleshooting actions. + * @member {string} [actionUriText] The information from the URI for the + * recommended troubleshooting actions. + */ +export interface TroubleshootingRecommendedActions { + actionId?: string; + actionText?: string; + actionUri?: string; + actionUriText?: string; +} + +/** + * @class + * Initializes a new instance of the TroubleshootingDetails class. + * @constructor + * Information gained from troubleshooting of specified resource. + * + * @member {string} [id] The id of the get troubleshoot operation. + * @member {string} [reasonType] Reason type of failure. + * @member {string} [summary] A summary of troubleshooting. + * @member {string} [detail] Details on troubleshooting results. + * @member {array} [recommendedActions] List of recommended actions. + */ +export interface TroubleshootingDetails { + id?: string; + reasonType?: string; + summary?: string; + detail?: string; + recommendedActions?: TroubleshootingRecommendedActions[]; +} + +/** + * @class + * Initializes a new instance of the TroubleshootingResult class. + * @constructor + * Troubleshooting information gained from specified resource. + * + * @member {date} [startTime] The start time of the troubleshooting. + * @member {date} [endTime] The end time of the troubleshooting. + * @member {string} [code] The result code of the troubleshooting. + * @member {array} [results] Information from troubleshooting. + */ +export interface TroubleshootingResult { + startTime?: Date; + endTime?: Date; + code?: string; + results?: TroubleshootingDetails[]; +} + +/** + * @class + * Initializes a new instance of the RetentionPolicyParameters class. + * @constructor + * Parameters that define the retention policy for flow log. + * + * @member {number} [days] Number of days to retain flow log records. Default + * value: 0 . + * @member {boolean} [enabled] Flag to enable/disable retention. Default value: + * false . + */ +export interface RetentionPolicyParameters { + days?: number; + enabled?: boolean; +} + +/** + * @class + * Initializes a new instance of the FlowLogStatusParameters class. + * @constructor + * Parameters that define a resource to query flow log status. + * + * @member {string} targetResourceId The target resource where getting the flow + * logging status. + */ +export interface FlowLogStatusParameters { + targetResourceId: string; +} + +/** + * @class + * Initializes a new instance of the FlowLogInformation class. + * @constructor + * Information on the configuration of flow log. + * + * @member {string} targetResourceId The ID of the resource to configure for + * flow logging. + * @member {string} storageId ID of the storage account which is used to store + * the flow log. + * @member {boolean} enabled Flag to enable/disable flow logging. + * @member {object} [retentionPolicy] + * @member {number} [retentionPolicy.days] Number of days to retain flow log + * records. + * @member {boolean} [retentionPolicy.enabled] Flag to enable/disable + * retention. + */ +export interface FlowLogInformation { + targetResourceId: string; + storageId: string; + enabled: boolean; + retentionPolicy?: RetentionPolicyParameters; +} + +/** + * @class + * Initializes a new instance of the ConnectivitySource class. + * @constructor + * Parameters that define the source of the connection. + * + * @member {string} resourceId The ID of the resource from which a connectivity + * check will be initiated. + * @member {number} [port] The source port from which a connectivity check will + * be performed. + */ +export interface ConnectivitySource { + resourceId: string; + port?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectivityDestination class. + * @constructor + * Parameters that define destination of connection. + * + * @member {string} [resourceId] The ID of the resource to which a connection + * attempt will be made. + * @member {string} [address] The IP address or URI the resource to which a + * connection attempt will be made. + * @member {number} [port] Port on which check connectivity will be performed. + */ +export interface ConnectivityDestination { + resourceId?: string; + address?: string; + port?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectivityParameters class. + * @constructor + * Parameters that determine how the connectivity check will be performed. + * + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource from which a + * connectivity check will be initiated. + * @member {number} [source.port] The source port from which a connectivity + * check will be performed. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource to which a + * connection attempt will be made. + * @member {string} [destination.address] The IP address or URI the resource to + * which a connection attempt will be made. + * @member {number} [destination.port] Port on which check connectivity will be + * performed. + */ +export interface ConnectivityParameters { + source: ConnectivitySource; + destination: ConnectivityDestination; +} + +/** + * @class + * Initializes a new instance of the ConnectivityIssue class. + * @constructor + * Information about an issue encountered in the process of checking for + * connectivity. + * + * @member {string} [origin] The origin of the issue. Possible values include: + * 'Local', 'Inbound', 'Outbound' + * @member {string} [severity] The severity of the issue. Possible values + * include: 'Error', 'Warning' + * @member {string} [type] The type of issue. Possible values include: + * 'Unknown', 'AgentStopped', 'GuestFirewall', 'DnsResolution', 'SocketBind', + * 'NetworkSecurityRule', 'UserDefinedRoute', 'PortThrottled', 'Platform' + * @member {array} [context] Provides additional context on the issue. + */ +export interface ConnectivityIssue { + readonly origin?: string; + readonly severity?: string; + readonly type?: string; + readonly context?: { [propertyName: string]: string }[]; +} + +/** + * @class + * Initializes a new instance of the ConnectivityHop class. + * @constructor + * Information about a hop between the source and the destination. + * + * @member {string} [type] The type of the hop. + * @member {string} [id] The ID of the hop. + * @member {string} [address] The IP address of the hop. + * @member {string} [resourceId] The ID of the resource corresponding to this + * hop. + * @member {array} [nextHopIds] List of next hop identifiers. + * @member {array} [issues] List of issues. + */ +export interface ConnectivityHop { + readonly type?: string; + readonly id?: string; + readonly address?: string; + readonly resourceId?: string; + readonly nextHopIds?: string[]; + readonly issues?: ConnectivityIssue[]; +} + +/** + * @class + * Initializes a new instance of the ConnectivityInformation class. + * @constructor + * Information on the connectivity status. + * + * @member {array} [hops] List of hops between the source and the destination. + * @member {string} [connectionStatus] The connection status. Possible values + * include: 'Unknown', 'Connected', 'Disconnected', 'Degraded' + * @member {number} [avgLatencyInMs] Average latency in milliseconds. + * @member {number} [minLatencyInMs] Minimum latency in milliseconds. + * @member {number} [maxLatencyInMs] Maximum latency in milliseconds. + * @member {number} [probesSent] Total number of probes sent. + * @member {number} [probesFailed] Number of failed probes. + */ +export interface ConnectivityInformation { + readonly hops?: ConnectivityHop[]; + readonly connectionStatus?: string; + readonly avgLatencyInMs?: number; + readonly minLatencyInMs?: number; + readonly maxLatencyInMs?: number; + readonly probesSent?: number; + readonly probesFailed?: number; +} + +/** + * @class + * Initializes a new instance of the AzureReachabilityReportLocation class. + * @constructor + * Parameters that define a geographic location. + * + * @member {string} country The name of the country. + * @member {string} [state] The name of the state. + * @member {string} [city] The name of the city or town. + */ +export interface AzureReachabilityReportLocation { + country: string; + state?: string; + city?: string; +} + +/** + * @class + * Initializes a new instance of the AzureReachabilityReportParameters class. + * @constructor + * Geographic and time constraints for Azure reachability report. + * + * @member {object} providerLocation + * @member {string} [providerLocation.country] The name of the country. + * @member {string} [providerLocation.state] The name of the state. + * @member {string} [providerLocation.city] The name of the city or town. + * @member {array} [providers] List of Internet service providers. + * @member {array} [azureLocations] Optional Azure regions to scope the query + * to. + * @member {date} startTime The start time for the Azure reachability report. + * @member {date} endTime The end time for the Azure reachability report. + */ +export interface AzureReachabilityReportParameters { + providerLocation: AzureReachabilityReportLocation; + providers?: string[]; + azureLocations?: string[]; + startTime: Date; + endTime: Date; +} + +/** + * @class + * Initializes a new instance of the AzureReachabilityReportLatencyInfo class. + * @constructor + * Details on latency for a time series. + * + * @member {date} [timeStamp] The time stamp. + * @member {number} [score] The relative latency score between 1 and 100, + * higher values indicating a faster connection. + */ +export interface AzureReachabilityReportLatencyInfo { + timeStamp?: Date; + score?: number; +} + +/** + * @class + * Initializes a new instance of the AzureReachabilityReportItem class. + * @constructor + * Azure reachability report details for a given provider location. + * + * @member {string} [provider] The Internet service provider. + * @member {string} [azureLocation] The Azure region. + * @member {array} [latencies] List of latency details for each of the time + * series. + */ +export interface AzureReachabilityReportItem { + provider?: string; + azureLocation?: string; + latencies?: AzureReachabilityReportLatencyInfo[]; +} + +/** + * @class + * Initializes a new instance of the AzureReachabilityReport class. + * @constructor + * Azure reachability report details. + * + * @member {string} aggregationLevel The aggregation level of Azure + * reachability report. Can be Country, State or City. + * @member {object} providerLocation + * @member {string} [providerLocation.country] The name of the country. + * @member {string} [providerLocation.state] The name of the state. + * @member {string} [providerLocation.city] The name of the city or town. + * @member {array} reachabilityReport List of Azure reachability report items. + */ +export interface AzureReachabilityReport { + aggregationLevel: string; + providerLocation: AzureReachabilityReportLocation; + reachabilityReport: AzureReachabilityReportItem[]; +} + +/** + * @class + * Initializes a new instance of the AvailableProvidersListParameters class. + * @constructor + * Constraints that determine the list of available Internet service providers. + * + * @member {array} [azureLocations] A list of Azure regions. + * @member {string} [country] The country for available providers list. + * @member {string} [state] The state for available providers list. + * @member {string} [city] The city or town for available providers list. + */ +export interface AvailableProvidersListParameters { + azureLocations?: string[]; + country?: string; + state?: string; + city?: string; +} + +/** + * @class + * Initializes a new instance of the AvailableProvidersListCity class. + * @constructor + * City or town details. + * + * @member {string} [cityName] The city or town name. + * @member {array} [providers] A list of Internet service providers. + */ +export interface AvailableProvidersListCity { + cityName?: string; + providers?: string[]; +} + +/** + * @class + * Initializes a new instance of the AvailableProvidersListState class. + * @constructor + * State details. + * + * @member {string} [stateName] The state name. + * @member {array} [providers] A list of Internet service providers. + * @member {array} [cities] List of available cities or towns in the state. + */ +export interface AvailableProvidersListState { + stateName?: string; + providers?: string[]; + cities?: AvailableProvidersListCity[]; +} + +/** + * @class + * Initializes a new instance of the AvailableProvidersListCountry class. + * @constructor + * Country details. + * + * @member {string} [countryName] The country name. + * @member {array} [providers] A list of Internet service providers. + * @member {array} [states] List of available states in the country. + */ +export interface AvailableProvidersListCountry { + countryName?: string; + providers?: string[]; + states?: AvailableProvidersListState[]; +} + +/** + * @class + * Initializes a new instance of the AvailableProvidersList class. + * @constructor + * List of available countries with details. + * + * @member {array} countries List of available countries. + */ +export interface AvailableProvidersList { + countries: AvailableProvidersListCountry[]; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorSource class. + * @constructor + * Describes the source of connection monitor. + * + * @member {string} resourceId The ID of the resource used as the source by + * connection monitor. + * @member {number} [port] The source port used by connection monitor. + */ +export interface ConnectionMonitorSource { + resourceId: string; + port?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorDestination class. + * @constructor + * Describes the destination of connection monitor. + * + * @member {string} [resourceId] The ID of the resource used as the destination + * by connection monitor. + * @member {string} [address] Address of the connection monitor destination (IP + * or domain name). + * @member {number} [port] The destination port used by connection monitor. + */ +export interface ConnectionMonitorDestination { + resourceId?: string; + address?: string; + port?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorParameters class. + * @constructor + * Parameters that define the operation to create a connection monitor. + * + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as the + * destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by connection + * monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + */ +export interface ConnectionMonitorParameters { + source: ConnectionMonitorSource; + destination: ConnectionMonitorDestination; + autoStart?: boolean; + monitoringIntervalInSeconds?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitor class. + * @constructor + * Parameters that define the operation to create a connection monitor. + * + * @member {string} [location] Connection monitor location. + * @member {object} [tags] Connection monitor tags. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as the + * destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by connection + * monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + */ +export interface ConnectionMonitor { + location?: string; + tags?: { [propertyName: string]: string }; + source: ConnectionMonitorSource; + destination: ConnectionMonitorDestination; + autoStart?: boolean; + monitoringIntervalInSeconds?: number; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorResult class. + * @constructor + * Information about the connection monitor. + * + * @member {string} [name] Name of the connection monitor. + * @member {string} [id] ID of the connection monitor. + * @member {string} [etag] Default value: 'A unique read-only string that + * changes whenever the resource is updated.' . + * @member {string} [type] Connection monitor type. + * @member {string} [location] Connection monitor location. + * @member {object} [tags] Connection monitor tags. + * @member {object} source + * @member {string} [source.resourceId] The ID of the resource used as the + * source by connection monitor. + * @member {number} [source.port] The source port used by connection monitor. + * @member {object} destination + * @member {string} [destination.resourceId] The ID of the resource used as the + * destination by connection monitor. + * @member {string} [destination.address] Address of the connection monitor + * destination (IP or domain name). + * @member {number} [destination.port] The destination port used by connection + * monitor. + * @member {boolean} [autoStart] Determines if the connection monitor will + * start automatically once created. Default value: true . + * @member {number} [monitoringIntervalInSeconds] Monitoring interval in + * seconds. Default value: 60 . + * @member {string} [provisioningState] The provisioning state of the + * connection monitor. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + * @member {date} [startTime] The date and time when the connection monitor was + * started. + * @member {string} [monitoringStatus] The monitoring status of the connection + * monitor. + */ +export interface ConnectionMonitorResult extends BaseResource { + readonly name?: string; + readonly id?: string; + etag?: string; + readonly type?: string; + location?: string; + tags?: { [propertyName: string]: string }; + source: ConnectionMonitorSource; + destination: ConnectionMonitorDestination; + autoStart?: boolean; + monitoringIntervalInSeconds?: number; + provisioningState?: string; + startTime?: Date; + monitoringStatus?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionStateSnapshot class. + * @constructor + * Connection state snapshot. + * + * @member {string} [connectionState] The connection state. Possible values + * include: 'Reachable', 'Unreachable', 'Unknown' + * @member {date} [startTime] The start time of the connection snapshot. + * @member {date} [endTime] The end time of the connection snapshot. + * @member {string} [evaluationState] Connectivity analysis evaluation state. + * Possible values include: 'NotStarted', 'InProgress', 'Completed' + * @member {array} [hops] List of hops between the source and the destination. + */ +export interface ConnectionStateSnapshot { + connectionState?: string; + startTime?: Date; + endTime?: Date; + evaluationState?: string; + readonly hops?: ConnectivityHop[]; +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorQueryResult class. + * @constructor + * List of connection states snaphots. + * + * @member {array} [states] Information about connection states. + */ +export interface ConnectionMonitorQueryResult { + states?: ConnectionStateSnapshot[]; +} + +/** + * @class + * Initializes a new instance of the OperationDisplay class. + * @constructor + * Display metadata associated with the operation. + * + * @member {string} [provider] Service provider: Microsoft Network. + * @member {string} [resource] Resource on which the operation is performed. + * @member {string} [operation] Type of the operation: get, read, delete, etc. + * @member {string} [description] Description of the operation. + */ +export interface OperationDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** + * @class + * Initializes a new instance of the Availability class. + * @constructor + * Availability of the metric. + * + * @member {string} [timeGrain] The time grain of the availability. + * @member {string} [retention] The retention of the availability. + * @member {string} [blobDuration] Duration of the availability blob. + */ +export interface Availability { + timeGrain?: string; + retention?: string; + blobDuration?: string; +} + +/** + * @class + * Initializes a new instance of the Dimension class. + * @constructor + * Dimension of the metric. + * + * @member {string} [name] The name of the dimension. + * @member {string} [displayName] The display name of the dimension. + * @member {string} [internalName] The internal name of the dimension. + */ +export interface Dimension { + name?: string; + displayName?: string; + internalName?: string; +} + +/** + * @class + * Initializes a new instance of the MetricSpecification class. + * @constructor + * Description of metrics specification. + * + * @member {string} [name] The name of the metric. + * @member {string} [displayName] The display name of the metric. + * @member {string} [displayDescription] The description of the metric. + * @member {string} [unit] Units the metric to be displayed in. + * @member {string} [aggregationType] The aggregation type. + * @member {array} [availabilities] List of availability. + * @member {boolean} [enableRegionalMdmAccount] Whether regional MDM account + * enabled. + * @member {boolean} [fillGapWithZero] Whether gaps would be filled with zeros. + * @member {string} [metricFilterPattern] Pattern for the filter of the metric. + * @member {array} [dimensions] List of dimensions. + * @member {boolean} [isInternal] Whether the metric is internal. + * @member {string} [sourceMdmAccount] The source MDM account. + * @member {string} [sourceMdmNamespace] The source MDM namespace. + * @member {string} [resourceIdDimensionNameOverride] The resource Id dimension + * name override. + */ +export interface MetricSpecification { + name?: string; + displayName?: string; + displayDescription?: string; + unit?: string; + aggregationType?: string; + availabilities?: Availability[]; + enableRegionalMdmAccount?: boolean; + fillGapWithZero?: boolean; + metricFilterPattern?: string; + dimensions?: Dimension[]; + isInternal?: boolean; + sourceMdmAccount?: string; + sourceMdmNamespace?: string; + resourceIdDimensionNameOverride?: string; +} + +/** + * @class + * Initializes a new instance of the LogSpecification class. + * @constructor + * Description of logging specification. + * + * @member {string} [name] The name of the specification. + * @member {string} [displayName] The display name of the specification. + * @member {string} [blobDuration] Duration of the blob. + */ +export interface LogSpecification { + name?: string; + displayName?: string; + blobDuration?: string; +} + +/** + * @class + * Initializes a new instance of the OperationPropertiesFormatServiceSpecification class. + * @constructor + * Specification of the service. + * + * @member {array} [metricSpecifications] Operation service specification. + * @member {array} [logSpecifications] Operation log specification. + */ +export interface OperationPropertiesFormatServiceSpecification { + metricSpecifications?: MetricSpecification[]; + logSpecifications?: LogSpecification[]; +} + +/** + * @class + * Initializes a new instance of the Operation class. + * @constructor + * Network REST API operation definition. + * + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft Network. + * @member {string} [display.resource] Resource on which the operation is + * performed. + * @member {string} [display.operation] Type of the operation: get, read, + * delete, etc. + * @member {string} [display.description] Description of the operation. + * @member {string} [origin] Origin of the operation. + * @member {object} [serviceSpecification] Specification of the service. + * @member {array} [serviceSpecification.metricSpecifications] Operation + * service specification. + * @member {array} [serviceSpecification.logSpecifications] Operation log + * specification. + */ +export interface Operation { + name?: string; + display?: OperationDisplay; + origin?: string; + serviceSpecification?: OperationPropertiesFormatServiceSpecification; +} + +/** + * @class + * Initializes a new instance of the PatchRouteFilterRule class. + * @constructor + * Route Filter Rule Resource + * + * @member {string} access The access type of the rule. Valid values are: + * 'Allow', 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} communities The collection for bgp community values to + * filter on. e.g. ['12076:5010','12076:5020'] + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface PatchRouteFilterRule extends SubResource { + access: string; + communities: string[]; + readonly provisioningState?: string; + readonly name?: string; + readonly etag?: string; +} + +/** + * @class + * Initializes a new instance of the PatchRouteFilter class. + * @constructor + * Route Filter Resource. + * + * @member {array} [rules] Collection of RouteFilterRules contained within a + * route filter. + * @member {array} [peerings] A collection of references to express route + * circuit peerings. + * @member {string} [provisioningState] The provisioning state of the resource. + * Possible values are: 'Updating', 'Deleting', 'Succeeded' and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + * @member {string} [type] Resource type. + * @member {object} [tags] Resource tags. + */ +export interface PatchRouteFilter extends SubResource { + rules?: RouteFilterRule[]; + peerings?: ExpressRouteCircuitPeering[]; + readonly provisioningState?: string; + readonly name?: string; + readonly etag?: string; + readonly type?: string; + tags?: { [propertyName: string]: string }; +} + +/** + * @class + * Initializes a new instance of the BGPCommunity class. + * @constructor + * Contains bgp community information offered in Service Community resources. + * + * @member {string} [serviceSupportedRegion] The region which the service + * support. e.g. For O365, region is Global. + * @member {string} [communityName] The name of the bgp community. e.g. Skype. + * @member {string} [communityValue] The value of the bgp community. For more + * information: + * https://docs.microsoft.com/en-us/azure/expressroute/expressroute-routing. + * @member {array} [communityPrefixes] The prefixes that the bgp community + * contains. + * @member {boolean} [isAuthorizedToUse] Customer is authorized to use bgp + * community or not. + * @member {string} [serviceGroup] The service group of the bgp community + * contains. + */ +export interface BGPCommunity { + serviceSupportedRegion?: string; + communityName?: string; + communityValue?: string; + communityPrefixes?: string[]; + isAuthorizedToUse?: boolean; + serviceGroup?: string; +} + +/** + * @class + * Initializes a new instance of the BgpServiceCommunity class. + * @constructor + * Service Community Properties. + * + * @member {string} [serviceName] The name of the bgp community. e.g. Skype. + * @member {array} [bgpCommunities] Get a list of bgp communities. + */ +export interface BgpServiceCommunity extends Resource { + serviceName?: string; + bgpCommunities?: BGPCommunity[]; +} + +/** + * @class + * Initializes a new instance of the UsageName class. + * @constructor + * The usage names. + * + * @member {string} [value] A string describing the resource name. + * @member {string} [localizedValue] A localized string describing the resource + * name. + */ +export interface UsageName { + value?: string; + localizedValue?: string; +} + +/** + * @class + * Initializes a new instance of the Usage class. + * @constructor + * Describes network resource usage. + * + * @member {string} [id] Resource identifier. + * @member {number} currentValue The current value of the usage. + * @member {number} limit The limit of usage. + * @member {object} name The name of the type of usage. + * @member {string} [name.value] A string describing the resource name. + * @member {string} [name.localizedValue] A localized string describing the + * resource name. + */ +export interface Usage { + readonly id?: string; + currentValue: number; + limit: number; + name: UsageName; +} + +/** + * @class + * Initializes a new instance of the AddressSpace class. + * @constructor + * AddressSpace contains an array of IP address ranges that can be used by + * subnets of the virtual network. + * + * @member {array} [addressPrefixes] A list of address blocks reserved for this + * virtual network in CIDR notation. + */ +export interface AddressSpace { + addressPrefixes?: string[]; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkPeering class. + * @constructor + * Peerings in a virtual network resource. + * + * @member {boolean} [allowVirtualNetworkAccess] Whether the VMs in the linked + * virtual network space would be able to access all the VMs in local Virtual + * network space. + * @member {boolean} [allowForwardedTraffic] Whether the forwarded traffic from + * the VMs in the remote virtual network will be allowed/disallowed. + * @member {boolean} [allowGatewayTransit] If gateway links can be used in + * remote virtual networking to link to this virtual network. + * @member {boolean} [useRemoteGateways] If remote gateways can be used on this + * virtual network. If the flag is set to true, and allowGatewayTransit on + * remote peering is also true, virtual network will use gateways of remote + * virtual network for transit. Only one peering can have this flag set to + * true. This flag cannot be set if virtual network already has a gateway. + * @member {object} [remoteVirtualNetwork] The reference of the remote virtual + * network. The remote virtual network can be in the same or different region + * (preview). See here to register for the preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * @member {string} [remoteVirtualNetwork.id] Resource ID. + * @member {object} [remoteAddressSpace] The reference of the remote virtual + * network address space. + * @member {array} [remoteAddressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * @member {string} [peeringState] The status of the virtual network peering. + * Possible values are 'Initiated', 'Connected', and 'Disconnected'. Possible + * values include: 'Initiated', 'Connected', 'Disconnected' + * @member {string} [provisioningState] The provisioning state of the resource. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface VirtualNetworkPeering extends SubResource { + allowVirtualNetworkAccess?: boolean; + allowForwardedTraffic?: boolean; + allowGatewayTransit?: boolean; + useRemoteGateways?: boolean; + remoteVirtualNetwork?: SubResource; + remoteAddressSpace?: AddressSpace; + peeringState?: string; + provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the DhcpOptions class. + * @constructor + * DhcpOptions contains an array of DNS servers available to VMs deployed in + * the virtual network. Standard DHCP option for a subnet overrides VNET DHCP + * options. + * + * @member {array} [dnsServers] The list of DNS servers IP addresses. + */ +export interface DhcpOptions { + dnsServers?: string[]; +} + +/** + * @class + * Initializes a new instance of the VirtualNetwork class. + * @constructor + * Virtual Network resource. + * + * @member {object} [addressSpace] The AddressSpace that contains an array of + * IP address ranges that can be used by subnets. + * @member {array} [addressSpace.addressPrefixes] A list of address blocks + * reserved for this virtual network in CIDR notation. + * @member {object} [dhcpOptions] The dhcpOptions that contains an array of DNS + * servers available to VMs deployed in the virtual network. + * @member {array} [dhcpOptions.dnsServers] The list of DNS servers IP + * addresses. + * @member {array} [subnets] A list of subnets in a Virtual Network. + * @member {array} [virtualNetworkPeerings] A list of peerings in a Virtual + * Network. + * @member {string} [resourceGuid] The resourceGuid property of the Virtual + * Network resource. + * @member {string} [provisioningState] The provisioning state of the PublicIP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {boolean} [enableDdosProtection] Indicates if DDoS protection is + * enabled for all the protected resources in the virtual network. It requires + * a DDoS protection plan associated with the resource. Default value: false . + * @member {boolean} [enableVmProtection] Indicates if VM protection is enabled + * for all the subnets in the virtual network. Default value: false . + * @member {object} [ddosProtectionPlan] The DDoS protection plan associated + * with the virtual network. + * @member {string} [ddosProtectionPlan.id] Resource ID. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualNetwork extends Resource { + addressSpace?: AddressSpace; + dhcpOptions?: DhcpOptions; + subnets?: Subnet[]; + virtualNetworkPeerings?: VirtualNetworkPeering[]; + resourceGuid?: string; + provisioningState?: string; + enableDdosProtection?: boolean; + enableVmProtection?: boolean; + ddosProtectionPlan?: SubResource; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the IPAddressAvailabilityResult class. + * @constructor + * Response for CheckIPAddressAvailability API service call + * + * @member {boolean} [available] Private IP address availability. + * @member {array} [availableIPAddresses] Contains other available private IP + * addresses if the asked for address is taken. + */ +export interface IPAddressAvailabilityResult { + available?: boolean; + availableIPAddresses?: string[]; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkUsageName class. + * @constructor + * Usage strings container. + * + * @member {string} [localizedValue] Localized subnet size and usage string. + * @member {string} [value] Subnet size and usage string. + */ +export interface VirtualNetworkUsageName { + readonly localizedValue?: string; + readonly value?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkUsage class. + * @constructor + * Usage details for subnet. + * + * @member {number} [currentValue] Indicates number of IPs used from the + * Subnet. + * @member {string} [id] Subnet identifier. + * @member {number} [limit] Indicates the size of the subnet. + * @member {object} [name] The name containing common and localized value for + * usage. + * @member {string} [name.localizedValue] Localized subnet size and usage + * string. + * @member {string} [name.value] Subnet size and usage string. + * @member {string} [unit] Usage units. Returns 'Count' + */ +export interface VirtualNetworkUsage { + readonly currentValue?: number; + readonly id?: string; + readonly limit?: number; + readonly name?: VirtualNetworkUsageName; + readonly unit?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayIPConfiguration class. + * @constructor + * IP configuration for virtual network gateway + * + * @member {string} [privateIPAllocationMethod] The private IP allocation + * method. Possible values are: 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.id] Resource ID. + * @member {object} [publicIPAddress] The reference of the public IP resource. + * @member {string} [publicIPAddress.id] Resource ID. + * @member {string} [provisioningState] The provisioning state of the public IP + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface VirtualNetworkGatewayIPConfiguration extends SubResource { + privateIPAllocationMethod?: string; + subnet?: SubResource; + publicIPAddress?: SubResource; + readonly provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewaySku class. + * @constructor + * VirtualNetworkGatewaySku details + * + * @member {string} [name] Gateway SKU name. Possible values include: 'Basic', + * 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', 'VpnGw2', + * 'VpnGw3' + * @member {string} [tier] Gateway SKU tier. Possible values include: 'Basic', + * 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', 'VpnGw2', + * 'VpnGw3' + * @member {number} [capacity] The capacity. + */ +export interface VirtualNetworkGatewaySku { + name?: string; + tier?: string; + capacity?: number; +} + +/** + * @class + * Initializes a new instance of the VpnClientRootCertificate class. + * @constructor + * VPN client root certificate of virtual network gateway + * + * @member {string} publicCertData The certificate public data. + * @member {string} [provisioningState] The provisioning state of the VPN + * client root certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface VpnClientRootCertificate extends SubResource { + publicCertData: string; + readonly provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the VpnClientRevokedCertificate class. + * @constructor + * VPN client revoked certificate of virtual network gateway. + * + * @member {string} [thumbprint] The revoked VPN client certificate thumbprint. + * @member {string} [provisioningState] The provisioning state of the VPN + * client revoked certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface VpnClientRevokedCertificate extends SubResource { + thumbprint?: string; + readonly provisioningState?: string; + name?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the IpsecPolicy class. + * @constructor + * An IPSec Policy configuration for a virtual network gateway connection + * + * @member {number} saLifeTimeSeconds The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site VPN + * tunnel. + * @member {number} saDataSizeKilobytes The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN + * tunnel. + * @member {string} ipsecEncryption The IPSec encryption algorithm (IKE phase + * 1). Possible values include: 'None', 'DES', 'DES3', 'AES128', 'AES192', + * 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * @member {string} ipsecIntegrity The IPSec integrity algorithm (IKE phase 1). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'GCMAES128', 'GCMAES192', + * 'GCMAES256' + * @member {string} ikeEncryption The IKE encryption algorithm (IKE phase 2). + * Possible values include: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', + * 'GCMAES256', 'GCMAES128' + * @member {string} ikeIntegrity The IKE integrity algorithm (IKE phase 2). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'SHA384', 'GCMAES256', + * 'GCMAES128' + * @member {string} dhGroup The DH Groups used in IKE Phase 1 for initial SA. + * Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', + * 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * @member {string} pfsGroup The Pfs Groups used in IKE Phase 2 for new child + * SA. Possible values include: 'None', 'PFS1', 'PFS2', 'PFS2048', 'ECP256', + * 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + */ +export interface IpsecPolicy { + saLifeTimeSeconds: number; + saDataSizeKilobytes: number; + ipsecEncryption: string; + ipsecIntegrity: string; + ikeEncryption: string; + ikeIntegrity: string; + dhGroup: string; + pfsGroup: string; +} + +/** + * @class + * Initializes a new instance of the VpnClientConfiguration class. + * @constructor + * VpnClientConfiguration for P2S client. + * + * @member {object} [vpnClientAddressPool] The reference of the address space + * resource which represents Address space for P2S VpnClient. + * @member {array} [vpnClientAddressPool.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * @member {array} [vpnClientRootCertificates] VpnClientRootCertificate for + * virtual network gateway. + * @member {array} [vpnClientRevokedCertificates] VpnClientRevokedCertificate + * for Virtual network gateway. + * @member {array} [vpnClientProtocols] VpnClientProtocols for Virtual network + * gateway. + * @member {array} [vpnClientIpsecPolicies] VpnClientIpsecPolicies for virtual + * network gateway P2S client. + * @member {string} [radiusServerAddress] The radius server address property of + * the VirtualNetworkGateway resource for vpn client connection. + * @member {string} [radiusServerSecret] The radius secret property of the + * VirtualNetworkGateway resource for vpn client connection. + */ +export interface VpnClientConfiguration { + vpnClientAddressPool?: AddressSpace; + vpnClientRootCertificates?: VpnClientRootCertificate[]; + vpnClientRevokedCertificates?: VpnClientRevokedCertificate[]; + vpnClientProtocols?: string[]; + vpnClientIpsecPolicies?: IpsecPolicy[]; + radiusServerAddress?: string; + radiusServerSecret?: string; +} + +/** + * @class + * Initializes a new instance of the BgpSettings class. + * @constructor + * BGP settings details + * + * @member {number} [asn] The BGP speaker's ASN. + * @member {string} [bgpPeeringAddress] The BGP peering address and BGP + * identifier of this BGP speaker. + * @member {number} [peerWeight] The weight added to routes learned from this + * BGP speaker. + */ +export interface BgpSettings { + asn?: number; + bgpPeeringAddress?: string; + peerWeight?: number; +} + +/** + * @class + * Initializes a new instance of the BgpPeerStatus class. + * @constructor + * BGP peer status details + * + * @member {string} [localAddress] The virtual network gateway's local address + * @member {string} [neighbor] The remote BGP peer + * @member {number} [asn] The autonomous system number of the remote BGP peer + * @member {string} [state] The BGP peer state. Possible values include: + * 'Unknown', 'Stopped', 'Idle', 'Connecting', 'Connected' + * @member {string} [connectedDuration] For how long the peering has been up + * @member {number} [routesReceived] The number of routes learned from this + * peer + * @member {number} [messagesSent] The number of BGP messages sent + * @member {number} [messagesReceived] The number of BGP messages received + */ +export interface BgpPeerStatus { + readonly localAddress?: string; + readonly neighbor?: string; + readonly asn?: number; + readonly state?: string; + readonly connectedDuration?: string; + readonly routesReceived?: number; + readonly messagesSent?: number; + readonly messagesReceived?: number; +} + +/** + * @class + * Initializes a new instance of the GatewayRoute class. + * @constructor + * Gateway routing details + * + * @member {string} [localAddress] The gateway's local address + * @member {string} [network] The route's network prefix + * @member {string} [nextHop] The route's next hop + * @member {string} [sourcePeer] The peer this route was learned from + * @member {string} [origin] The source this route was learned from + * @member {string} [asPath] The route's AS path sequence + * @member {number} [weight] The route's weight + */ +export interface GatewayRoute { + readonly localAddress?: string; + readonly network?: string; + readonly nextHop?: string; + readonly sourcePeer?: string; + readonly origin?: string; + readonly asPath?: string; + readonly weight?: number; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGateway class. + * @constructor + * A common class for general resource information + * + * @member {array} [ipConfigurations] IP configurations for virtual network + * gateway. + * @member {string} [gatewayType] The type of this virtual network gateway. + * Possible values are: 'Vpn' and 'ExpressRoute'. Possible values include: + * 'Vpn', 'ExpressRoute' + * @member {string} [vpnType] The type of this virtual network gateway. + * Possible values are: 'PolicyBased' and 'RouteBased'. Possible values + * include: 'PolicyBased', 'RouteBased' + * @member {boolean} [enableBgp] Whether BGP is enabled for this virtual + * network gateway or not. + * @member {boolean} [activeActive] ActiveActive flag + * @member {object} [gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * @member {string} [gatewayDefaultSite.id] Resource ID. + * @member {object} [sku] The reference of the VirtualNetworkGatewaySku + * resource which represents the SKU selected for Virtual network gateway. + * @member {string} [sku.name] Gateway SKU name. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {string} [sku.tier] Gateway SKU tier. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {number} [sku.capacity] The capacity. + * @member {object} [vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * @member {object} [vpnClientConfiguration.vpnClientAddressPool] The reference + * of the address space resource which represents Address space for P2S + * VpnClient. + * @member {array} + * [vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * @member {array} [vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} [vpnClientConfiguration.radiusServerAddress] The radius + * server address property of the VirtualNetworkGateway resource for vpn client + * connection. + * @member {string} [vpnClientConfiguration.radiusServerSecret] The radius + * secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * @member {object} [bgpSettings] Virtual network gateway's BGP speaker + * settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address and + * BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes learned + * from this BGP speaker. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualNetworkGateway extends Resource { + ipConfigurations?: VirtualNetworkGatewayIPConfiguration[]; + gatewayType?: string; + vpnType?: string; + enableBgp?: boolean; + activeActive?: boolean; + gatewayDefaultSite?: SubResource; + sku?: VirtualNetworkGatewaySku; + vpnClientConfiguration?: VpnClientConfiguration; + bgpSettings?: BgpSettings; + resourceGuid?: string; + readonly provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the VpnClientParameters class. + * @constructor + * Vpn Client Parameters for package generation + * + * @member {string} [processorArchitecture] VPN client Processor Architecture. + * Possible values are: 'AMD64' and 'X86'. Possible values include: 'Amd64', + * 'X86' + * @member {string} [authenticationMethod] VPN client Authentication Method. + * Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values include: + * 'EAPTLS', 'EAPMSCHAPv2' + * @member {string} [radiusServerAuthCertificate] The public certificate data + * for the radius server authentication certificate as a Base-64 encoded + * string. Required only if external radius authentication has been configured + * with EAPTLS authentication. + * @member {array} [clientRootCertificates] A list of client root certificates + * public certificate data encoded as Base-64 strings. Optional parameter for + * external radius based authentication with EAPTLS. + */ +export interface VpnClientParameters { + processorArchitecture?: string; + authenticationMethod?: string; + radiusServerAuthCertificate?: string; + clientRootCertificates?: string[]; +} + +/** + * @class + * Initializes a new instance of the BgpPeerStatusListResult class. + * @constructor + * Response for list BGP peer status API service call + * + * @member {array} [value] List of BGP peers + */ +export interface BgpPeerStatusListResult { + value?: BgpPeerStatus[]; +} + +/** + * @class + * Initializes a new instance of the GatewayRouteListResult class. + * @constructor + * List of virtual network gateway routes + * + * @member {array} [value] List of gateway routes + */ +export interface GatewayRouteListResult { + value?: GatewayRoute[]; +} + +/** + * @class + * Initializes a new instance of the TunnelConnectionHealth class. + * @constructor + * VirtualNetworkGatewayConnection properties + * + * @member {string} [tunnel] Tunnel name. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * @member {number} [ingressBytesTransferred] The Ingress Bytes Transferred in + * this connection + * @member {number} [egressBytesTransferred] The Egress Bytes Transferred in + * this connection + * @member {string} [lastConnectionEstablishedUtcTime] The time at which + * connection was established in Utc format. + */ +export interface TunnelConnectionHealth { + readonly tunnel?: string; + readonly connectionStatus?: string; + readonly ingressBytesTransferred?: number; + readonly egressBytesTransferred?: number; + readonly lastConnectionEstablishedUtcTime?: string; +} + +/** + * @class + * Initializes a new instance of the LocalNetworkGateway class. + * @constructor + * A common class for general resource information + * + * @member {object} [localNetworkAddressSpace] Local network site address + * space. + * @member {array} [localNetworkAddressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * @member {string} [gatewayIpAddress] IP address of local network gateway. + * @member {object} [bgpSettings] Local network gateway's BGP speaker settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address and + * BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes learned + * from this BGP speaker. + * @member {string} [resourceGuid] The resource GUID property of the + * LocalNetworkGateway resource. + * @member {string} [provisioningState] The provisioning state of the + * LocalNetworkGateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever the + * resource is updated. + */ +export interface LocalNetworkGateway extends Resource { + localNetworkAddressSpace?: AddressSpace; + gatewayIpAddress?: string; + bgpSettings?: BgpSettings; + resourceGuid?: string; + readonly provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayConnection class. + * @constructor + * A common class for general resource information + * + * @member {string} [authorizationKey] The authorizationKey. + * @member {object} virtualNetworkGateway1 The reference to virtual network + * gateway resource. + * @member {array} [virtualNetworkGateway1.ipConfigurations] IP configurations + * for virtual network gateway. + * @member {string} [virtualNetworkGateway1.gatewayType] The type of this + * virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * @member {string} [virtualNetworkGateway1.vpnType] The type of this virtual + * network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. + * Possible values include: 'PolicyBased', 'RouteBased' + * @member {boolean} [virtualNetworkGateway1.enableBgp] Whether BGP is enabled + * for this virtual network gateway or not. + * @member {boolean} [virtualNetworkGateway1.activeActive] ActiveActive flag + * @member {object} [virtualNetworkGateway1.gatewayDefaultSite] The reference + * of the LocalNetworkGateway resource which represents local network site + * having default routes. Assign Null value in case of removing existing + * default site setting. + * @member {string} [virtualNetworkGateway1.gatewayDefaultSite.id] Resource ID. + * @member {object} [virtualNetworkGateway1.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * @member {string} [virtualNetworkGateway1.sku.name] Gateway SKU name. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {string} [virtualNetworkGateway1.sku.tier] Gateway SKU tier. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {number} [virtualNetworkGateway1.sku.capacity] The capacity. + * @member {object} [virtualNetworkGateway1.vpnClientConfiguration] The + * reference of the VpnClientConfiguration resource which represents the P2S + * VpnClient configurations. + * @member {object} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] + * A list of address blocks reserved for this virtual network in CIDR notation. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} + * [virtualNetworkGateway1.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * @member {string} + * [virtualNetworkGateway1.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * @member {object} [virtualNetworkGateway1.bgpSettings] Virtual network + * gateway's BGP speaker settings. + * @member {number} [virtualNetworkGateway1.bgpSettings.asn] The BGP speaker's + * ASN. + * @member {string} [virtualNetworkGateway1.bgpSettings.bgpPeeringAddress] The + * BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [virtualNetworkGateway1.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * @member {string} [virtualNetworkGateway1.resourceGuid] The resource GUID + * property of the VirtualNetworkGateway resource. + * @member {string} [virtualNetworkGateway1.provisioningState] The provisioning + * state of the VirtualNetworkGateway resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [virtualNetworkGateway1.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * @member {object} [virtualNetworkGateway2] The reference to virtual network + * gateway resource. + * @member {array} [virtualNetworkGateway2.ipConfigurations] IP configurations + * for virtual network gateway. + * @member {string} [virtualNetworkGateway2.gatewayType] The type of this + * virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * @member {string} [virtualNetworkGateway2.vpnType] The type of this virtual + * network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. + * Possible values include: 'PolicyBased', 'RouteBased' + * @member {boolean} [virtualNetworkGateway2.enableBgp] Whether BGP is enabled + * for this virtual network gateway or not. + * @member {boolean} [virtualNetworkGateway2.activeActive] ActiveActive flag + * @member {object} [virtualNetworkGateway2.gatewayDefaultSite] The reference + * of the LocalNetworkGateway resource which represents local network site + * having default routes. Assign Null value in case of removing existing + * default site setting. + * @member {string} [virtualNetworkGateway2.gatewayDefaultSite.id] Resource ID. + * @member {object} [virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * @member {string} [virtualNetworkGateway2.sku.name] Gateway SKU name. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {string} [virtualNetworkGateway2.sku.tier] Gateway SKU tier. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {number} [virtualNetworkGateway2.sku.capacity] The capacity. + * @member {object} [virtualNetworkGateway2.vpnClientConfiguration] The + * reference of the VpnClientConfiguration resource which represents the P2S + * VpnClient configurations. + * @member {object} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] + * A list of address blocks reserved for this virtual network in CIDR notation. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} + * [virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * @member {string} + * [virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * @member {object} [virtualNetworkGateway2.bgpSettings] Virtual network + * gateway's BGP speaker settings. + * @member {number} [virtualNetworkGateway2.bgpSettings.asn] The BGP speaker's + * ASN. + * @member {string} [virtualNetworkGateway2.bgpSettings.bgpPeeringAddress] The + * BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [virtualNetworkGateway2.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * @member {string} [virtualNetworkGateway2.resourceGuid] The resource GUID + * property of the VirtualNetworkGateway resource. + * @member {string} [virtualNetworkGateway2.provisioningState] The provisioning + * state of the VirtualNetworkGateway resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [virtualNetworkGateway2.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * @member {object} [localNetworkGateway2] The reference to local network + * gateway resource. + * @member {object} [localNetworkGateway2.localNetworkAddressSpace] Local + * network site address space. + * @member {array} + * [localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * @member {string} [localNetworkGateway2.gatewayIpAddress] IP address of local + * network gateway. + * @member {object} [localNetworkGateway2.bgpSettings] Local network gateway's + * BGP speaker settings. + * @member {number} [localNetworkGateway2.bgpSettings.asn] The BGP speaker's + * ASN. + * @member {string} [localNetworkGateway2.bgpSettings.bgpPeeringAddress] The + * BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [localNetworkGateway2.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * @member {string} [localNetworkGateway2.resourceGuid] The resource GUID + * property of the LocalNetworkGateway resource. + * @member {string} [localNetworkGateway2.provisioningState] The provisioning + * state of the LocalNetworkGateway resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [localNetworkGateway2.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {string} connectionType Gateway connection type. Possible values + * are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible values + * include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * @member {number} [routingWeight] The routing weight. + * @member {string} [sharedKey] The IPSec shared key. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values are 'Unknown', 'Connecting', 'Connected' and + * 'NotConnected'. Possible values include: 'Unknown', 'Connecting', + * 'Connected', 'NotConnected' + * @member {array} [tunnelConnectionStatus] Collection of all tunnels' + * connection health status. + * @member {number} [egressBytesTransferred] The egress bytes transferred in + * this connection. + * @member {number} [ingressBytesTransferred] The ingress bytes transferred in + * this connection. + * @member {object} [peer] The reference to peerings resource. + * @member {string} [peer.id] Resource ID. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {boolean} [usePolicyBasedTrafficSelectors] Enable policy-based + * traffic selectors. + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by this + * connection. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGatewayConnection resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualNetworkGatewayConnection extends Resource { + authorizationKey?: string; + virtualNetworkGateway1: VirtualNetworkGateway; + virtualNetworkGateway2?: VirtualNetworkGateway; + localNetworkGateway2?: LocalNetworkGateway; + connectionType: string; + routingWeight?: number; + sharedKey?: string; + readonly connectionStatus?: string; + readonly tunnelConnectionStatus?: TunnelConnectionHealth[]; + readonly egressBytesTransferred?: number; + readonly ingressBytesTransferred?: number; + peer?: SubResource; + enableBgp?: boolean; + usePolicyBasedTrafficSelectors?: boolean; + ipsecPolicies?: IpsecPolicy[]; + resourceGuid?: string; + readonly provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the ConnectionResetSharedKey class. + * @constructor + * The virtual network connection reset shared key + * + * @member {number} keyLength The virtual network connection reset shared key + * length, should between 1 and 128. + */ +export interface ConnectionResetSharedKey { + keyLength: number; +} + +/** + * @class + * Initializes a new instance of the ConnectionSharedKey class. + * @constructor + * Response for GetConnectionSharedKey API service call + * + * @member {string} value The virtual network connection shared key value. + */ +export interface ConnectionSharedKey { + value: string; +} + +/** + * @class + * Initializes a new instance of the VpnClientIPsecParameters class. + * @constructor + * An IPSec parameters for a virtual network gateway P2S connection. + * + * @member {number} saLifeTimeSeconds The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + * @member {number} saDataSizeKilobytes The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + * @member {string} ipsecEncryption The IPSec encryption algorithm (IKE phase + * 1). Possible values include: 'None', 'DES', 'DES3', 'AES128', 'AES192', + * 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * @member {string} ipsecIntegrity The IPSec integrity algorithm (IKE phase 1). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'GCMAES128', 'GCMAES192', + * 'GCMAES256' + * @member {string} ikeEncryption The IKE encryption algorithm (IKE phase 2). + * Possible values include: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', + * 'GCMAES256', 'GCMAES128' + * @member {string} ikeIntegrity The IKE integrity algorithm (IKE phase 2). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'SHA384', 'GCMAES256', + * 'GCMAES128' + * @member {string} dhGroup The DH Groups used in IKE Phase 1 for initial SA. + * Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', + * 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * @member {string} pfsGroup The Pfs Groups used in IKE Phase 2 for new child + * SA. Possible values include: 'None', 'PFS1', 'PFS2', 'PFS2048', 'ECP256', + * 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + */ +export interface VpnClientIPsecParameters { + saLifeTimeSeconds: number; + saDataSizeKilobytes: number; + ipsecEncryption: string; + ipsecIntegrity: string; + ikeEncryption: string; + ikeIntegrity: string; + dhGroup: string; + pfsGroup: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkConnectionGatewayReference class. + * @constructor + * A reference to VirtualNetworkGateway or LocalNetworkGateway resource. + * + * @member {string} id The ID of VirtualNetworkGateway or LocalNetworkGateway + * resource. + */ +export interface VirtualNetworkConnectionGatewayReference { + id: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayConnectionListEntity class. + * @constructor + * A common class for general resource information + * + * @member {string} [authorizationKey] The authorizationKey. + * @member {object} virtualNetworkGateway1 The reference to virtual network + * gateway resource. + * @member {string} [virtualNetworkGateway1.id] The ID of VirtualNetworkGateway + * or LocalNetworkGateway resource. + * @member {object} [virtualNetworkGateway2] The reference to virtual network + * gateway resource. + * @member {string} [virtualNetworkGateway2.id] The ID of VirtualNetworkGateway + * or LocalNetworkGateway resource. + * @member {object} [localNetworkGateway2] The reference to local network + * gateway resource. + * @member {string} [localNetworkGateway2.id] The ID of VirtualNetworkGateway + * or LocalNetworkGateway resource. + * @member {string} connectionType Gateway connection type. Possible values + * are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible values + * include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * @member {number} [routingWeight] The routing weight. + * @member {string} [sharedKey] The IPSec shared key. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values are 'Unknown', 'Connecting', 'Connected' and + * 'NotConnected'. Possible values include: 'Unknown', 'Connecting', + * 'Connected', 'NotConnected' + * @member {array} [tunnelConnectionStatus] Collection of all tunnels' + * connection health status. + * @member {number} [egressBytesTransferred] The egress bytes transferred in + * this connection. + * @member {number} [ingressBytesTransferred] The ingress bytes transferred in + * this connection. + * @member {object} [peer] The reference to peerings resource. + * @member {string} [peer.id] Resource ID. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {boolean} [usePolicyBasedTrafficSelectors] Enable policy-based + * traffic selectors. + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by this + * connection. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGatewayConnection resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes whenever + * the resource is updated. + */ +export interface VirtualNetworkGatewayConnectionListEntity extends Resource { + authorizationKey?: string; + virtualNetworkGateway1: VirtualNetworkConnectionGatewayReference; + virtualNetworkGateway2?: VirtualNetworkConnectionGatewayReference; + localNetworkGateway2?: VirtualNetworkConnectionGatewayReference; + connectionType: string; + routingWeight?: number; + sharedKey?: string; + readonly connectionStatus?: string; + readonly tunnelConnectionStatus?: TunnelConnectionHealth[]; + readonly egressBytesTransferred?: number; + readonly ingressBytesTransferred?: number; + peer?: SubResource; + enableBgp?: boolean; + usePolicyBasedTrafficSelectors?: boolean; + ipsecPolicies?: IpsecPolicy[]; + resourceGuid?: string; + readonly provisioningState?: string; + etag?: string; +} + +/** + * @class + * Initializes a new instance of the VpnDeviceScriptParameters class. + * @constructor + * Vpn device configuration script generation parameters + * + * @member {string} [vendor] The vendor for the vpn device. + * @member {string} [deviceFamily] The device family for the vpn device. + * @member {string} [firmwareVersion] The firmware version for the vpn device. + */ +export interface VpnDeviceScriptParameters { + vendor?: string; + deviceFamily?: string; + firmwareVersion?: string; +} + + +/** + * @class + * Initializes a new instance of the ApplicationGatewayListResult class. + * @constructor + * Response for ListApplicationGateways API service call. + * + * @member {string} [nextLink] URL to get the next set of results. + */ +export interface ApplicationGatewayListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationGatewayAvailableSslPredefinedPolicies class. + * @constructor + * Response for ApplicationGatewayAvailableSslOptions API service call. + * + * @member {string} [nextLink] URL to get the next set of results. + */ +export interface ApplicationGatewayAvailableSslPredefinedPolicies extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ApplicationSecurityGroupListResult class. + * @constructor + * A list of application security groups. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ApplicationSecurityGroupListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the DdosProtectionPlanListResult class. + * @constructor + * A list of DDoS protection plans. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface DdosProtectionPlanListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the EndpointServicesListResult class. + * @constructor + * Response for the ListAvailableEndpointServices API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface EndpointServicesListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the AuthorizationListResult class. + * @constructor + * Response for ListAuthorizations API service call retrieves all + * authorizations that belongs to an ExpressRouteCircuit. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface AuthorizationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitPeeringListResult class. + * @constructor + * Response for ListPeering API service call retrieves all peerings that belong + * to an ExpressRouteCircuit. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCircuitPeeringListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCircuitListResult class. + * @constructor + * Response for ListExpressRouteCircuit API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCircuitListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteServiceProviderListResult class. + * @constructor + * Response for the ListExpressRouteServiceProvider API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteServiceProviderListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnectionListResult class. + * @constructor + * Response for ListExpressRouteCrossConnection API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCrossConnectionListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the ExpressRouteCrossConnectionPeeringList class. + * @constructor + * Response for ListPeering API service call retrieves all peerings that belong + * to an ExpressRouteCrossConnection. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface ExpressRouteCrossConnectionPeeringList extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerListResult class. + * @constructor + * Response for ListLoadBalancers API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LoadBalancerListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerBackendAddressPoolListResult class. + * @constructor + * Response for ListBackendAddressPool API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LoadBalancerBackendAddressPoolListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerFrontendIPConfigurationListResult class. + * @constructor + * Response for ListFrontendIPConfiguration API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LoadBalancerFrontendIPConfigurationListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the InboundNatRuleListResult class. + * @constructor + * Response for ListInboundNatRule API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface InboundNatRuleListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerLoadBalancingRuleListResult class. + * @constructor + * Response for ListLoadBalancingRule API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LoadBalancerLoadBalancingRuleListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceListResult class. + * @constructor + * Response for the ListNetworkInterface API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface NetworkInterfaceListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LoadBalancerProbeListResult class. + * @constructor + * Response for ListProbe API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LoadBalancerProbeListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceIPConfigurationListResult class. + * @constructor + * Response for list ip configurations API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface NetworkInterfaceIPConfigurationListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkInterfaceLoadBalancerListResult class. + * @constructor + * Response for list ip configurations API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface NetworkInterfaceLoadBalancerListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkSecurityGroupListResult class. + * @constructor + * Response for ListNetworkSecurityGroups API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface NetworkSecurityGroupListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SecurityRuleListResult class. + * @constructor + * Response for ListSecurityRule API service call. Retrieves all security rules + * that belongs to a network security group. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface SecurityRuleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the NetworkWatcherListResult class. + * @constructor + * List of network watcher resources. + * + */ +export interface NetworkWatcherListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the PacketCaptureListResult class. + * @constructor + * List of packet capture sessions. + * + */ +export interface PacketCaptureListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the ConnectionMonitorListResult class. + * @constructor + * List of connection monitors. + * + */ +export interface ConnectionMonitorListResult extends Array { +} + +/** + * @class + * Initializes a new instance of the OperationListResult class. + * @constructor + * Result of the request to list Network operations. It contains a list of + * operations and a URL link to get the next set of results. + * + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ +export interface OperationListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the PublicIPAddressListResult class. + * @constructor + * Response for ListPublicIpAddresses API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface PublicIPAddressListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RouteFilterListResult class. + * @constructor + * Response for the ListRouteFilters API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface RouteFilterListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RouteFilterRuleListResult class. + * @constructor + * Response for the ListRouteFilterRules API service call + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface RouteFilterRuleListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RouteTableListResult class. + * @constructor + * Response for the ListRouteTable API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface RouteTableListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the RouteListResult class. + * @constructor + * Response for the ListRoute API service call + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface RouteListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the BgpServiceCommunityListResult class. + * @constructor + * Response for the ListServiceCommunity API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface BgpServiceCommunityListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the UsagesListResult class. + * @constructor + * The list usages operation response. + * + * @member {string} [nextLink] URL to get the next set of results. + */ +export interface UsagesListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkListResult class. + * @constructor + * Response for the ListVirtualNetworks API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkListUsageResult class. + * @constructor + * Response for the virtual networks GetUsage API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkListUsageResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the SubnetListResult class. + * @constructor + * Response for ListSubnets API service callRetrieves all subnet that belongs + * to a virtual network + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface SubnetListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkPeeringListResult class. + * @constructor + * Response for ListSubnets API service call. Retrieves all subnets that belong + * to a virtual network. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkPeeringListResult extends Array { + nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayListResult class. + * @constructor + * Response for the ListVirtualNetworkGateways API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkGatewayListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayListConnectionsResult class. + * @constructor + * Response for the VirtualNetworkGatewayListConnections API service call + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkGatewayListConnectionsResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the VirtualNetworkGatewayConnectionListResult class. + * @constructor + * Response for the ListVirtualNetworkGatewayConnections API service call + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface VirtualNetworkGatewayConnectionListResult extends Array { + readonly nextLink?: string; +} + +/** + * @class + * Initializes a new instance of the LocalNetworkGatewayListResult class. + * @constructor + * Response for ListLocalNetworkGateways API service call. + * + * @member {string} [nextLink] The URL to get the next set of results. + */ +export interface LocalNetworkGatewayListResult extends Array { + readonly nextLink?: string; +} diff --git a/lib/services/networkManagement2/lib/lib/models/index.js b/lib/services/networkManagement2/lib/lib/models/index.js new file mode 100644 index 0000000000..6f5fcdaa5d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/index.js @@ -0,0 +1,250 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +var msRestAzure = require('ms-rest-azure'); + +exports.BaseResource = msRestAzure.BaseResource; +exports.CloudError = msRestAzure.CloudError; +exports.SubResource = require('./subResource'); +exports.BackendAddressPool = require('./backendAddressPool'); +exports.InboundNatRule = require('./inboundNatRule'); +exports.Resource = require('./resource'); +exports.ApplicationSecurityGroup = require('./applicationSecurityGroup'); +exports.SecurityRule = require('./securityRule'); +exports.NetworkInterfaceDnsSettings = require('./networkInterfaceDnsSettings'); +exports.NetworkInterface = require('./networkInterface'); +exports.NetworkSecurityGroup = require('./networkSecurityGroup'); +exports.Route = require('./route'); +exports.RouteTable = require('./routeTable'); +exports.ServiceEndpointPropertiesFormat = require('./serviceEndpointPropertiesFormat'); +exports.PublicIPAddressSku = require('./publicIPAddressSku'); +exports.PublicIPAddressDnsSettings = require('./publicIPAddressDnsSettings'); +exports.IpTag = require('./ipTag'); +exports.PublicIPAddress = require('./publicIPAddress'); +exports.IPConfiguration = require('./iPConfiguration'); +exports.ResourceNavigationLink = require('./resourceNavigationLink'); +exports.Subnet = require('./subnet'); +exports.NetworkInterfaceIPConfiguration = require('./networkInterfaceIPConfiguration'); +exports.ApplicationGatewayBackendAddress = require('./applicationGatewayBackendAddress'); +exports.ApplicationGatewayBackendAddressPool = require('./applicationGatewayBackendAddressPool'); +exports.ApplicationGatewayConnectionDraining = require('./applicationGatewayConnectionDraining'); +exports.ApplicationGatewayBackendHttpSettings = require('./applicationGatewayBackendHttpSettings'); +exports.ApplicationGatewayBackendHealthServer = require('./applicationGatewayBackendHealthServer'); +exports.ApplicationGatewayBackendHealthHttpSettings = require('./applicationGatewayBackendHealthHttpSettings'); +exports.ApplicationGatewayBackendHealthPool = require('./applicationGatewayBackendHealthPool'); +exports.ApplicationGatewayBackendHealth = require('./applicationGatewayBackendHealth'); +exports.ApplicationGatewaySku = require('./applicationGatewaySku'); +exports.ApplicationGatewaySslPolicy = require('./applicationGatewaySslPolicy'); +exports.ApplicationGatewayIPConfiguration = require('./applicationGatewayIPConfiguration'); +exports.ApplicationGatewayAuthenticationCertificate = require('./applicationGatewayAuthenticationCertificate'); +exports.ApplicationGatewaySslCertificate = require('./applicationGatewaySslCertificate'); +exports.ApplicationGatewayFrontendIPConfiguration = require('./applicationGatewayFrontendIPConfiguration'); +exports.ApplicationGatewayFrontendPort = require('./applicationGatewayFrontendPort'); +exports.ApplicationGatewayHttpListener = require('./applicationGatewayHttpListener'); +exports.ApplicationGatewayPathRule = require('./applicationGatewayPathRule'); +exports.ApplicationGatewayProbeHealthResponseMatch = require('./applicationGatewayProbeHealthResponseMatch'); +exports.ApplicationGatewayProbe = require('./applicationGatewayProbe'); +exports.ApplicationGatewayRequestRoutingRule = require('./applicationGatewayRequestRoutingRule'); +exports.ApplicationGatewayRedirectConfiguration = require('./applicationGatewayRedirectConfiguration'); +exports.ApplicationGatewayUrlPathMap = require('./applicationGatewayUrlPathMap'); +exports.ApplicationGatewayFirewallDisabledRuleGroup = require('./applicationGatewayFirewallDisabledRuleGroup'); +exports.ApplicationGatewayWebApplicationFirewallConfiguration = require('./applicationGatewayWebApplicationFirewallConfiguration'); +exports.ApplicationGateway = require('./applicationGateway'); +exports.ApplicationGatewayFirewallRule = require('./applicationGatewayFirewallRule'); +exports.ApplicationGatewayFirewallRuleGroup = require('./applicationGatewayFirewallRuleGroup'); +exports.ApplicationGatewayFirewallRuleSet = require('./applicationGatewayFirewallRuleSet'); +exports.ApplicationGatewayAvailableWafRuleSetsResult = require('./applicationGatewayAvailableWafRuleSetsResult'); +exports.ApplicationGatewayAvailableSslOptions = require('./applicationGatewayAvailableSslOptions'); +exports.ApplicationGatewaySslPredefinedPolicy = require('./applicationGatewaySslPredefinedPolicy'); +exports.TagsObject = require('./tagsObject'); +exports.DnsNameAvailabilityResult = require('./dnsNameAvailabilityResult'); +exports.DdosProtectionPlan = require('./ddosProtectionPlan'); +exports.EndpointServiceResult = require('./endpointServiceResult'); +exports.ExpressRouteCircuitAuthorization = require('./expressRouteCircuitAuthorization'); +exports.ExpressRouteCircuitPeeringConfig = require('./expressRouteCircuitPeeringConfig'); +exports.RouteFilterRule = require('./routeFilterRule'); +exports.ExpressRouteCircuitStats = require('./expressRouteCircuitStats'); +exports.ExpressRouteCircuitConnection = require('./expressRouteCircuitConnection'); +exports.ExpressRouteCircuitPeering = require('./expressRouteCircuitPeering'); +exports.RouteFilter = require('./routeFilter'); +exports.Ipv6ExpressRouteCircuitPeeringConfig = require('./ipv6ExpressRouteCircuitPeeringConfig'); +exports.ExpressRouteCircuitSku = require('./expressRouteCircuitSku'); +exports.ExpressRouteCircuitServiceProviderProperties = require('./expressRouteCircuitServiceProviderProperties'); +exports.ExpressRouteCircuit = require('./expressRouteCircuit'); +exports.ExpressRouteCircuitArpTable = require('./expressRouteCircuitArpTable'); +exports.ExpressRouteCircuitsArpTableListResult = require('./expressRouteCircuitsArpTableListResult'); +exports.ExpressRouteCircuitRoutesTable = require('./expressRouteCircuitRoutesTable'); +exports.ExpressRouteCircuitsRoutesTableListResult = require('./expressRouteCircuitsRoutesTableListResult'); +exports.ExpressRouteCircuitRoutesTableSummary = require('./expressRouteCircuitRoutesTableSummary'); +exports.ExpressRouteCircuitsRoutesTableSummaryListResult = require('./expressRouteCircuitsRoutesTableSummaryListResult'); +exports.ExpressRouteServiceProviderBandwidthsOffered = require('./expressRouteServiceProviderBandwidthsOffered'); +exports.ExpressRouteServiceProvider = require('./expressRouteServiceProvider'); +exports.ExpressRouteCrossConnectionRoutesTableSummary = require('./expressRouteCrossConnectionRoutesTableSummary'); +exports.ExpressRouteCrossConnectionsRoutesTableSummaryListResult = require('./expressRouteCrossConnectionsRoutesTableSummaryListResult'); +exports.ExpressRouteCircuitReference = require('./expressRouteCircuitReference'); +exports.ExpressRouteCrossConnectionPeering = require('./expressRouteCrossConnectionPeering'); +exports.ExpressRouteCrossConnection = require('./expressRouteCrossConnection'); +exports.LoadBalancerSku = require('./loadBalancerSku'); +exports.FrontendIPConfiguration = require('./frontendIPConfiguration'); +exports.LoadBalancingRule = require('./loadBalancingRule'); +exports.Probe = require('./probe'); +exports.InboundNatPool = require('./inboundNatPool'); +exports.OutboundNatRule = require('./outboundNatRule'); +exports.LoadBalancer = require('./loadBalancer'); +exports.ErrorDetails = require('./errorDetails'); +exports.ErrorModel = require('./errorModel'); +exports.AzureAsyncOperationResult = require('./azureAsyncOperationResult'); +exports.EffectiveNetworkSecurityGroupAssociation = require('./effectiveNetworkSecurityGroupAssociation'); +exports.EffectiveNetworkSecurityRule = require('./effectiveNetworkSecurityRule'); +exports.EffectiveNetworkSecurityGroup = require('./effectiveNetworkSecurityGroup'); +exports.EffectiveNetworkSecurityGroupListResult = require('./effectiveNetworkSecurityGroupListResult'); +exports.EffectiveRoute = require('./effectiveRoute'); +exports.EffectiveRouteListResult = require('./effectiveRouteListResult'); +exports.NetworkWatcher = require('./networkWatcher'); +exports.TopologyParameters = require('./topologyParameters'); +exports.TopologyAssociation = require('./topologyAssociation'); +exports.TopologyResource = require('./topologyResource'); +exports.Topology = require('./topology'); +exports.VerificationIPFlowParameters = require('./verificationIPFlowParameters'); +exports.VerificationIPFlowResult = require('./verificationIPFlowResult'); +exports.NextHopParameters = require('./nextHopParameters'); +exports.NextHopResult = require('./nextHopResult'); +exports.SecurityGroupViewParameters = require('./securityGroupViewParameters'); +exports.NetworkInterfaceAssociation = require('./networkInterfaceAssociation'); +exports.SubnetAssociation = require('./subnetAssociation'); +exports.SecurityRuleAssociations = require('./securityRuleAssociations'); +exports.SecurityGroupNetworkInterface = require('./securityGroupNetworkInterface'); +exports.SecurityGroupViewResult = require('./securityGroupViewResult'); +exports.PacketCaptureStorageLocation = require('./packetCaptureStorageLocation'); +exports.PacketCaptureFilter = require('./packetCaptureFilter'); +exports.PacketCaptureParameters = require('./packetCaptureParameters'); +exports.PacketCapture = require('./packetCapture'); +exports.PacketCaptureResult = require('./packetCaptureResult'); +exports.PacketCaptureQueryStatusResult = require('./packetCaptureQueryStatusResult'); +exports.TroubleshootingParameters = require('./troubleshootingParameters'); +exports.QueryTroubleshootingParameters = require('./queryTroubleshootingParameters'); +exports.TroubleshootingRecommendedActions = require('./troubleshootingRecommendedActions'); +exports.TroubleshootingDetails = require('./troubleshootingDetails'); +exports.TroubleshootingResult = require('./troubleshootingResult'); +exports.RetentionPolicyParameters = require('./retentionPolicyParameters'); +exports.FlowLogStatusParameters = require('./flowLogStatusParameters'); +exports.FlowLogInformation = require('./flowLogInformation'); +exports.ConnectivitySource = require('./connectivitySource'); +exports.ConnectivityDestination = require('./connectivityDestination'); +exports.ConnectivityParameters = require('./connectivityParameters'); +exports.ConnectivityIssue = require('./connectivityIssue'); +exports.ConnectivityHop = require('./connectivityHop'); +exports.ConnectivityInformation = require('./connectivityInformation'); +exports.AzureReachabilityReportLocation = require('./azureReachabilityReportLocation'); +exports.AzureReachabilityReportParameters = require('./azureReachabilityReportParameters'); +exports.AzureReachabilityReportLatencyInfo = require('./azureReachabilityReportLatencyInfo'); +exports.AzureReachabilityReportItem = require('./azureReachabilityReportItem'); +exports.AzureReachabilityReport = require('./azureReachabilityReport'); +exports.AvailableProvidersListParameters = require('./availableProvidersListParameters'); +exports.AvailableProvidersListCity = require('./availableProvidersListCity'); +exports.AvailableProvidersListState = require('./availableProvidersListState'); +exports.AvailableProvidersListCountry = require('./availableProvidersListCountry'); +exports.AvailableProvidersList = require('./availableProvidersList'); +exports.ConnectionMonitorSource = require('./connectionMonitorSource'); +exports.ConnectionMonitorDestination = require('./connectionMonitorDestination'); +exports.ConnectionMonitorParameters = require('./connectionMonitorParameters'); +exports.ConnectionMonitor = require('./connectionMonitor'); +exports.ConnectionMonitorResult = require('./connectionMonitorResult'); +exports.ConnectionStateSnapshot = require('./connectionStateSnapshot'); +exports.ConnectionMonitorQueryResult = require('./connectionMonitorQueryResult'); +exports.OperationDisplay = require('./operationDisplay'); +exports.Availability = require('./availability'); +exports.Dimension = require('./dimension'); +exports.MetricSpecification = require('./metricSpecification'); +exports.LogSpecification = require('./logSpecification'); +exports.OperationPropertiesFormatServiceSpecification = require('./operationPropertiesFormatServiceSpecification'); +exports.Operation = require('./operation'); +exports.PatchRouteFilterRule = require('./patchRouteFilterRule'); +exports.PatchRouteFilter = require('./patchRouteFilter'); +exports.BGPCommunity = require('./bGPCommunity'); +exports.BgpServiceCommunity = require('./bgpServiceCommunity'); +exports.UsageName = require('./usageName'); +exports.Usage = require('./usage'); +exports.AddressSpace = require('./addressSpace'); +exports.VirtualNetworkPeering = require('./virtualNetworkPeering'); +exports.DhcpOptions = require('./dhcpOptions'); +exports.VirtualNetwork = require('./virtualNetwork'); +exports.IPAddressAvailabilityResult = require('./iPAddressAvailabilityResult'); +exports.VirtualNetworkUsageName = require('./virtualNetworkUsageName'); +exports.VirtualNetworkUsage = require('./virtualNetworkUsage'); +exports.VirtualNetworkGatewayIPConfiguration = require('./virtualNetworkGatewayIPConfiguration'); +exports.VirtualNetworkGatewaySku = require('./virtualNetworkGatewaySku'); +exports.VpnClientRootCertificate = require('./vpnClientRootCertificate'); +exports.VpnClientRevokedCertificate = require('./vpnClientRevokedCertificate'); +exports.IpsecPolicy = require('./ipsecPolicy'); +exports.VpnClientConfiguration = require('./vpnClientConfiguration'); +exports.BgpSettings = require('./bgpSettings'); +exports.BgpPeerStatus = require('./bgpPeerStatus'); +exports.GatewayRoute = require('./gatewayRoute'); +exports.VirtualNetworkGateway = require('./virtualNetworkGateway'); +exports.VpnClientParameters = require('./vpnClientParameters'); +exports.BgpPeerStatusListResult = require('./bgpPeerStatusListResult'); +exports.GatewayRouteListResult = require('./gatewayRouteListResult'); +exports.TunnelConnectionHealth = require('./tunnelConnectionHealth'); +exports.LocalNetworkGateway = require('./localNetworkGateway'); +exports.VirtualNetworkGatewayConnection = require('./virtualNetworkGatewayConnection'); +exports.ConnectionResetSharedKey = require('./connectionResetSharedKey'); +exports.ConnectionSharedKey = require('./connectionSharedKey'); +exports.VpnClientIPsecParameters = require('./vpnClientIPsecParameters'); +exports.VirtualNetworkConnectionGatewayReference = require('./virtualNetworkConnectionGatewayReference'); +exports.VirtualNetworkGatewayConnectionListEntity = require('./virtualNetworkGatewayConnectionListEntity'); +exports.VpnDeviceScriptParameters = require('./vpnDeviceScriptParameters'); +exports.ApplicationGatewayListResult = require('./applicationGatewayListResult'); +exports.ApplicationGatewayAvailableSslPredefinedPolicies = require('./applicationGatewayAvailableSslPredefinedPolicies'); +exports.ApplicationSecurityGroupListResult = require('./applicationSecurityGroupListResult'); +exports.DdosProtectionPlanListResult = require('./ddosProtectionPlanListResult'); +exports.EndpointServicesListResult = require('./endpointServicesListResult'); +exports.AuthorizationListResult = require('./authorizationListResult'); +exports.ExpressRouteCircuitPeeringListResult = require('./expressRouteCircuitPeeringListResult'); +exports.ExpressRouteCircuitListResult = require('./expressRouteCircuitListResult'); +exports.ExpressRouteServiceProviderListResult = require('./expressRouteServiceProviderListResult'); +exports.ExpressRouteCrossConnectionListResult = require('./expressRouteCrossConnectionListResult'); +exports.ExpressRouteCrossConnectionPeeringList = require('./expressRouteCrossConnectionPeeringList'); +exports.LoadBalancerListResult = require('./loadBalancerListResult'); +exports.LoadBalancerBackendAddressPoolListResult = require('./loadBalancerBackendAddressPoolListResult'); +exports.LoadBalancerFrontendIPConfigurationListResult = require('./loadBalancerFrontendIPConfigurationListResult'); +exports.InboundNatRuleListResult = require('./inboundNatRuleListResult'); +exports.LoadBalancerLoadBalancingRuleListResult = require('./loadBalancerLoadBalancingRuleListResult'); +exports.NetworkInterfaceListResult = require('./networkInterfaceListResult'); +exports.LoadBalancerProbeListResult = require('./loadBalancerProbeListResult'); +exports.NetworkInterfaceIPConfigurationListResult = require('./networkInterfaceIPConfigurationListResult'); +exports.NetworkInterfaceLoadBalancerListResult = require('./networkInterfaceLoadBalancerListResult'); +exports.NetworkSecurityGroupListResult = require('./networkSecurityGroupListResult'); +exports.SecurityRuleListResult = require('./securityRuleListResult'); +exports.NetworkWatcherListResult = require('./networkWatcherListResult'); +exports.PacketCaptureListResult = require('./packetCaptureListResult'); +exports.ConnectionMonitorListResult = require('./connectionMonitorListResult'); +exports.OperationListResult = require('./operationListResult'); +exports.PublicIPAddressListResult = require('./publicIPAddressListResult'); +exports.RouteFilterListResult = require('./routeFilterListResult'); +exports.RouteFilterRuleListResult = require('./routeFilterRuleListResult'); +exports.RouteTableListResult = require('./routeTableListResult'); +exports.RouteListResult = require('./routeListResult'); +exports.BgpServiceCommunityListResult = require('./bgpServiceCommunityListResult'); +exports.UsagesListResult = require('./usagesListResult'); +exports.VirtualNetworkListResult = require('./virtualNetworkListResult'); +exports.VirtualNetworkListUsageResult = require('./virtualNetworkListUsageResult'); +exports.SubnetListResult = require('./subnetListResult'); +exports.VirtualNetworkPeeringListResult = require('./virtualNetworkPeeringListResult'); +exports.VirtualNetworkGatewayListResult = require('./virtualNetworkGatewayListResult'); +exports.VirtualNetworkGatewayListConnectionsResult = require('./virtualNetworkGatewayListConnectionsResult'); +exports.VirtualNetworkGatewayConnectionListResult = require('./virtualNetworkGatewayConnectionListResult'); +exports.LocalNetworkGatewayListResult = require('./localNetworkGatewayListResult'); diff --git a/lib/services/networkManagement2/lib/lib/models/ipTag.js b/lib/services/networkManagement2/lib/lib/models/ipTag.js new file mode 100644 index 0000000000..f6352a0ffa --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/ipTag.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Contains the IpTag associated with the public IP address + * + */ +class IpTag { + /** + * Create a IpTag. + * @member {string} [ipTagType] Gets or sets the ipTag type: Example + * FirstPartyUsage. + * @member {string} [tag] Gets or sets value of the IpTag associated with the + * public IP. Example SQL, Storage etc + */ + constructor() { + } + + /** + * Defines the metadata of IpTag + * + * @returns {object} metadata of IpTag + * + */ + mapper() { + return { + required: false, + serializedName: 'IpTag', + type: { + name: 'Composite', + className: 'IpTag', + modelProperties: { + ipTagType: { + required: false, + serializedName: 'ipTagType', + type: { + name: 'String' + } + }, + tag: { + required: false, + serializedName: 'tag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IpTag; diff --git a/lib/services/networkManagement2/lib/lib/models/ipsecPolicy.js b/lib/services/networkManagement2/lib/lib/models/ipsecPolicy.js new file mode 100644 index 0000000000..ee16d6a604 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/ipsecPolicy.js @@ -0,0 +1,124 @@ +/* + * 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'; + +/** + * An IPSec Policy configuration for a virtual network gateway connection + * + */ +class IpsecPolicy { + /** + * Create a IpsecPolicy. + * @member {number} saLifeTimeSeconds The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) lifetime in seconds for a site to site + * VPN tunnel. + * @member {number} saDataSizeKilobytes The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) payload size in KB for a site to site VPN + * tunnel. + * @member {string} ipsecEncryption The IPSec encryption algorithm (IKE phase + * 1). Possible values include: 'None', 'DES', 'DES3', 'AES128', 'AES192', + * 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * @member {string} ipsecIntegrity The IPSec integrity algorithm (IKE phase + * 1). Possible values include: 'MD5', 'SHA1', 'SHA256', 'GCMAES128', + * 'GCMAES192', 'GCMAES256' + * @member {string} ikeEncryption The IKE encryption algorithm (IKE phase 2). + * Possible values include: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', + * 'GCMAES256', 'GCMAES128' + * @member {string} ikeIntegrity The IKE integrity algorithm (IKE phase 2). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'SHA384', 'GCMAES256', + * 'GCMAES128' + * @member {string} dhGroup The DH Groups used in IKE Phase 1 for initial SA. + * Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', + * 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * @member {string} pfsGroup The Pfs Groups used in IKE Phase 2 for new child + * SA. Possible values include: 'None', 'PFS1', 'PFS2', 'PFS2048', 'ECP256', + * 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + */ + constructor() { + } + + /** + * Defines the metadata of IpsecPolicy + * + * @returns {object} metadata of IpsecPolicy + * + */ + mapper() { + return { + required: false, + serializedName: 'IpsecPolicy', + type: { + name: 'Composite', + className: 'IpsecPolicy', + modelProperties: { + saLifeTimeSeconds: { + required: true, + serializedName: 'saLifeTimeSeconds', + type: { + name: 'Number' + } + }, + saDataSizeKilobytes: { + required: true, + serializedName: 'saDataSizeKilobytes', + type: { + name: 'Number' + } + }, + ipsecEncryption: { + required: true, + serializedName: 'ipsecEncryption', + type: { + name: 'String' + } + }, + ipsecIntegrity: { + required: true, + serializedName: 'ipsecIntegrity', + type: { + name: 'String' + } + }, + ikeEncryption: { + required: true, + serializedName: 'ikeEncryption', + type: { + name: 'String' + } + }, + ikeIntegrity: { + required: true, + serializedName: 'ikeIntegrity', + type: { + name: 'String' + } + }, + dhGroup: { + required: true, + serializedName: 'dhGroup', + type: { + name: 'String' + } + }, + pfsGroup: { + required: true, + serializedName: 'pfsGroup', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = IpsecPolicy; diff --git a/lib/services/networkManagement2/lib/lib/models/ipv6ExpressRouteCircuitPeeringConfig.js b/lib/services/networkManagement2/lib/lib/models/ipv6ExpressRouteCircuitPeeringConfig.js new file mode 100644 index 0000000000..c171731b9d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/ipv6ExpressRouteCircuitPeeringConfig.js @@ -0,0 +1,115 @@ +/* + * 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'); + +/** + * Contains IPv6 peering config. + * + */ +class Ipv6ExpressRouteCircuitPeeringConfig { + /** + * Create a Ipv6ExpressRouteCircuitPeeringConfig. + * @member {string} [primaryPeerAddressPrefix] The primary address prefix. + * @member {string} [secondaryPeerAddressPrefix] The secondary address + * prefix. + * @member {object} [microsoftPeeringConfig] The Microsoft peering + * configuration. + * @member {array} [microsoftPeeringConfig.advertisedPublicPrefixes] The + * reference of AdvertisedPublicPrefixes. + * @member {array} [microsoftPeeringConfig.advertisedCommunities] The + * communities of bgp peering. Spepcified for microsoft peering + * @member {string} [microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * @member {number} [microsoftPeeringConfig.legacyMode] The legacy mode of + * the peering. + * @member {number} [microsoftPeeringConfig.customerASN] The CustomerASN of + * the peering. + * @member {string} [microsoftPeeringConfig.routingRegistryName] The + * RoutingRegistryName of the configuration. + * @member {object} [routeFilter] The reference of the RouteFilter resource. + * @member {array} [routeFilter.rules] Collection of RouteFilterRules + * contained within a route filter. + * @member {array} [routeFilter.peerings] A collection of references to + * express route circuit peerings. + * @member {string} [routeFilter.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [routeFilter.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {string} [state] The state of peering. Possible values are: + * 'Disabled' and 'Enabled'. Possible values include: 'Disabled', 'Enabled' + */ + constructor() { + } + + /** + * Defines the metadata of Ipv6ExpressRouteCircuitPeeringConfig + * + * @returns {object} metadata of Ipv6ExpressRouteCircuitPeeringConfig + * + */ + mapper() { + return { + required: false, + serializedName: 'Ipv6ExpressRouteCircuitPeeringConfig', + type: { + name: 'Composite', + className: 'Ipv6ExpressRouteCircuitPeeringConfig', + modelProperties: { + primaryPeerAddressPrefix: { + required: false, + serializedName: 'primaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + secondaryPeerAddressPrefix: { + required: false, + serializedName: 'secondaryPeerAddressPrefix', + type: { + name: 'String' + } + }, + microsoftPeeringConfig: { + required: false, + serializedName: 'microsoftPeeringConfig', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeeringConfig' + } + }, + routeFilter: { + required: false, + serializedName: 'routeFilter', + type: { + name: 'Composite', + className: 'RouteFilter' + } + }, + state: { + required: false, + serializedName: 'state', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Ipv6ExpressRouteCircuitPeeringConfig; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancer.js b/lib/services/networkManagement2/lib/lib/models/loadBalancer.js new file mode 100644 index 0000000000..a0e73dfe7b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancer.js @@ -0,0 +1,260 @@ +/* + * 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'); + +/** + * LoadBalancer resource + * + * @extends models['Resource'] + */ +class LoadBalancer extends models['Resource'] { + /** + * Create a LoadBalancer. + * @member {object} [sku] The load balancer SKU. + * @member {string} [sku.name] Name of a load balancer SKU. Possible values + * include: 'Basic', 'Standard' + * @member {array} [frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * @member {array} [backendAddressPools] Collection of backend address pools + * used by a load balancer + * @member {array} [loadBalancingRules] Object collection representing the + * load balancing rules Gets the provisioning + * @member {array} [probes] Collection of probe objects used in the load + * balancer + * @member {array} [inboundNatRules] Collection of inbound NAT Rules used by + * a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools + * are referenced from virtual machine scale sets. NICs that are associated + * with individual virtual machines cannot reference an Inbound NAT pool. + * They have to reference individual inbound NAT rules. + * @member {array} [inboundNatPools] Defines an external port range for + * inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual + * virtual machines cannot reference an inbound NAT pool. They have to + * reference individual inbound NAT rules. + * @member {array} [outboundNatRules] The outbound NAT rules. + * @member {string} [resourceGuid] The resource GUID property of the load + * balancer resource. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancer + * + * @returns {object} metadata of LoadBalancer + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancer', + type: { + name: 'Composite', + className: 'LoadBalancer', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'LoadBalancerSku' + } + }, + frontendIPConfigurations: { + required: false, + serializedName: 'properties.frontendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontendIPConfigurationElementType', + type: { + name: 'Composite', + className: 'FrontendIPConfiguration' + } + } + } + }, + backendAddressPools: { + required: false, + serializedName: 'properties.backendAddressPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendAddressPoolElementType', + type: { + name: 'Composite', + className: 'BackendAddressPool' + } + } + } + }, + loadBalancingRules: { + required: false, + serializedName: 'properties.loadBalancingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancingRuleElementType', + type: { + name: 'Composite', + className: 'LoadBalancingRule' + } + } + } + }, + probes: { + required: false, + serializedName: 'properties.probes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ProbeElementType', + type: { + name: 'Composite', + className: 'Probe' + } + } + } + }, + inboundNatRules: { + required: false, + serializedName: 'properties.inboundNatRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InboundNatRuleElementType', + type: { + name: 'Composite', + className: 'InboundNatRule' + } + } + } + }, + inboundNatPools: { + required: false, + serializedName: 'properties.inboundNatPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InboundNatPoolElementType', + type: { + name: 'Composite', + className: 'InboundNatPool' + } + } + } + }, + outboundNatRules: { + required: false, + serializedName: 'properties.outboundNatRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OutboundNatRuleElementType', + type: { + name: 'Composite', + className: 'OutboundNatRule' + } + } + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancer; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerBackendAddressPoolListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerBackendAddressPoolListResult.js new file mode 100644 index 0000000000..0950d568de --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerBackendAddressPoolListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListBackendAddressPool API service call. + */ +class LoadBalancerBackendAddressPoolListResult extends Array { + /** + * Create a LoadBalancerBackendAddressPoolListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerBackendAddressPoolListResult + * + * @returns {object} metadata of LoadBalancerBackendAddressPoolListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerBackendAddressPoolListResult', + type: { + name: 'Composite', + className: 'LoadBalancerBackendAddressPoolListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendAddressPoolElementType', + type: { + name: 'Composite', + className: 'BackendAddressPool' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerBackendAddressPoolListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerFrontendIPConfigurationListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerFrontendIPConfigurationListResult.js new file mode 100644 index 0000000000..f7833aa361 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerFrontendIPConfigurationListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListFrontendIPConfiguration API service call. + */ +class LoadBalancerFrontendIPConfigurationListResult extends Array { + /** + * Create a LoadBalancerFrontendIPConfigurationListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerFrontendIPConfigurationListResult + * + * @returns {object} metadata of LoadBalancerFrontendIPConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerFrontendIPConfigurationListResult', + type: { + name: 'Composite', + className: 'LoadBalancerFrontendIPConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'FrontendIPConfigurationElementType', + type: { + name: 'Composite', + className: 'FrontendIPConfiguration' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerFrontendIPConfigurationListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerListResult.js new file mode 100644 index 0000000000..23583728e8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListLoadBalancers API service call. + */ +class LoadBalancerListResult extends Array { + /** + * Create a LoadBalancerListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerListResult + * + * @returns {object} metadata of LoadBalancerListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerListResult', + type: { + name: 'Composite', + className: 'LoadBalancerListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancerElementType', + type: { + name: 'Composite', + className: 'LoadBalancer' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerLoadBalancingRuleListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerLoadBalancingRuleListResult.js new file mode 100644 index 0000000000..d2d4db85ca --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerLoadBalancingRuleListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListLoadBalancingRule API service call. + */ +class LoadBalancerLoadBalancingRuleListResult extends Array { + /** + * Create a LoadBalancerLoadBalancingRuleListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerLoadBalancingRuleListResult + * + * @returns {object} metadata of LoadBalancerLoadBalancingRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerLoadBalancingRuleListResult', + type: { + name: 'Composite', + className: 'LoadBalancerLoadBalancingRuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancingRuleElementType', + type: { + name: 'Composite', + className: 'LoadBalancingRule' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerLoadBalancingRuleListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerProbeListResult.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerProbeListResult.js new file mode 100644 index 0000000000..c56bf7bd1b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerProbeListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListProbe API service call. + */ +class LoadBalancerProbeListResult extends Array { + /** + * Create a LoadBalancerProbeListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancerProbeListResult + * + * @returns {object} metadata of LoadBalancerProbeListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerProbeListResult', + type: { + name: 'Composite', + className: 'LoadBalancerProbeListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ProbeElementType', + type: { + name: 'Composite', + className: 'Probe' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerProbeListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancerSku.js b/lib/services/networkManagement2/lib/lib/models/loadBalancerSku.js new file mode 100644 index 0000000000..b0779d1650 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancerSku.js @@ -0,0 +1,53 @@ +/* + * 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'; + +/** + * SKU of a load balancer + * + */ +class LoadBalancerSku { + /** + * Create a LoadBalancerSku. + * @member {string} [name] Name of a load balancer SKU. Possible values + * include: 'Basic', 'Standard' + */ + constructor() { + } + + /** + * Defines the metadata of LoadBalancerSku + * + * @returns {object} metadata of LoadBalancerSku + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancerSku', + type: { + name: 'Composite', + className: 'LoadBalancerSku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancerSku; diff --git a/lib/services/networkManagement2/lib/lib/models/loadBalancingRule.js b/lib/services/networkManagement2/lib/lib/models/loadBalancingRule.js new file mode 100644 index 0000000000..fd17df9a64 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/loadBalancingRule.js @@ -0,0 +1,187 @@ +/* + * 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'); + +/** + * A load balancing rule for a load balancer. + * + * @extends models['SubResource'] + */ +class LoadBalancingRule extends models['SubResource'] { + /** + * Create a LoadBalancingRule. + * @member {object} [frontendIPConfiguration] A reference to frontend IP + * addresses. + * @member {string} [frontendIPConfiguration.id] Resource ID. + * @member {object} [backendAddressPool] A reference to a pool of DIPs. + * Inbound traffic is randomly load balanced across IPs in the backend IPs. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {object} [probe] The reference of the load balancer probe used by + * the load balancing rule. + * @member {string} [probe.id] Resource ID. + * @member {string} protocol Possible values include: 'Udp', 'Tcp', 'All' + * @member {string} [loadDistribution] The load distribution policy for this + * rule. Possible values are 'Default', 'SourceIP', and 'SourceIPProtocol'. + * Possible values include: 'Default', 'SourceIP', 'SourceIPProtocol' + * @member {number} frontendPort The port for the external endpoint. Port + * numbers for each rule must be unique within the Load Balancer. Acceptable + * values are between 0 and 65534. Note that value 0 enables "Any Port" + * @member {number} [backendPort] The port used for internal connections on + * the endpoint. Acceptable values are between 0 and 65535. Note that value 0 + * enables "Any Port" + * @member {number} [idleTimeoutInMinutes] The timeout for the TCP idle + * connection. The value can be set between 4 and 30 minutes. The default + * value is 4 minutes. This element is only used when the protocol is set to + * TCP. + * @member {boolean} [enableFloatingIP] Configures a virtual machine's + * endpoint for the floating IP capability required to configure a SQL + * AlwaysOn Availability Group. This setting is required when using the SQL + * AlwaysOn Availability Groups in SQL server. This setting can't be changed + * after you create the endpoint. + * @member {boolean} [disableOutboundSnat] Configures SNAT for the VMs in the + * backend pool to use the publicIP address specified in the frontend of the + * load balancing rule. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LoadBalancingRule + * + * @returns {object} metadata of LoadBalancingRule + * + */ + mapper() { + return { + required: false, + serializedName: 'LoadBalancingRule', + type: { + name: 'Composite', + className: 'LoadBalancingRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + frontendIPConfiguration: { + required: false, + serializedName: 'properties.frontendIPConfiguration', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + backendAddressPool: { + required: false, + serializedName: 'properties.backendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + probe: { + required: false, + serializedName: 'properties.probe', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + protocol: { + required: true, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + loadDistribution: { + required: false, + serializedName: 'properties.loadDistribution', + type: { + name: 'String' + } + }, + frontendPort: { + required: true, + serializedName: 'properties.frontendPort', + type: { + name: 'Number' + } + }, + backendPort: { + required: false, + serializedName: 'properties.backendPort', + type: { + name: 'Number' + } + }, + idleTimeoutInMinutes: { + required: false, + serializedName: 'properties.idleTimeoutInMinutes', + type: { + name: 'Number' + } + }, + enableFloatingIP: { + required: false, + serializedName: 'properties.enableFloatingIP', + type: { + name: 'Boolean' + } + }, + disableOutboundSnat: { + required: false, + serializedName: 'properties.disableOutboundSnat', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LoadBalancingRule; diff --git a/lib/services/networkManagement2/lib/lib/models/localNetworkGateway.js b/lib/services/networkManagement2/lib/lib/models/localNetworkGateway.js new file mode 100644 index 0000000000..2ec08f4459 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/localNetworkGateway.js @@ -0,0 +1,156 @@ +/* + * 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'); + +/** + * A common class for general resource information + * + * @extends models['Resource'] + */ +class LocalNetworkGateway extends models['Resource'] { + /** + * Create a LocalNetworkGateway. + * @member {object} [localNetworkAddressSpace] Local network site address + * space. + * @member {array} [localNetworkAddressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * @member {string} [gatewayIpAddress] IP address of local network gateway. + * @member {object} [bgpSettings] Local network gateway's BGP speaker + * settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address + * and BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes + * learned from this BGP speaker. + * @member {string} [resourceGuid] The resource GUID property of the + * LocalNetworkGateway resource. + * @member {string} [provisioningState] The provisioning state of the + * LocalNetworkGateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LocalNetworkGateway + * + * @returns {object} metadata of LocalNetworkGateway + * + */ + mapper() { + return { + required: false, + serializedName: 'LocalNetworkGateway', + type: { + name: 'Composite', + className: 'LocalNetworkGateway', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + localNetworkAddressSpace: { + required: false, + serializedName: 'properties.localNetworkAddressSpace', + type: { + name: 'Composite', + className: 'AddressSpace' + } + }, + gatewayIpAddress: { + required: false, + serializedName: 'properties.gatewayIpAddress', + type: { + name: 'String' + } + }, + bgpSettings: { + required: false, + serializedName: 'properties.bgpSettings', + type: { + name: 'Composite', + className: 'BgpSettings' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LocalNetworkGateway; diff --git a/lib/services/networkManagement2/lib/lib/models/localNetworkGatewayListResult.js b/lib/services/networkManagement2/lib/lib/models/localNetworkGatewayListResult.js new file mode 100644 index 0000000000..83f2432d5d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/localNetworkGatewayListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListLocalNetworkGateways API service call. + */ +class LocalNetworkGatewayListResult extends Array { + /** + * Create a LocalNetworkGatewayListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of LocalNetworkGatewayListResult + * + * @returns {object} metadata of LocalNetworkGatewayListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'LocalNetworkGatewayListResult', + type: { + name: 'Composite', + className: 'LocalNetworkGatewayListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LocalNetworkGatewayElementType', + type: { + name: 'Composite', + className: 'LocalNetworkGateway' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LocalNetworkGatewayListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/logSpecification.js b/lib/services/networkManagement2/lib/lib/models/logSpecification.js new file mode 100644 index 0000000000..bd032c17ec --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/logSpecification.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Description of logging specification. + * + */ +class LogSpecification { + /** + * Create a LogSpecification. + * @member {string} [name] The name of the specification. + * @member {string} [displayName] The display name of the specification. + * @member {string} [blobDuration] Duration of the blob. + */ + constructor() { + } + + /** + * Defines the metadata of LogSpecification + * + * @returns {object} metadata of LogSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'LogSpecification', + type: { + name: 'Composite', + className: 'LogSpecification', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + blobDuration: { + required: false, + serializedName: 'blobDuration', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = LogSpecification; diff --git a/lib/services/networkManagement2/lib/lib/models/metricSpecification.js b/lib/services/networkManagement2/lib/lib/models/metricSpecification.js new file mode 100644 index 0000000000..7299f04339 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/metricSpecification.js @@ -0,0 +1,178 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Description of metrics specification. + * + */ +class MetricSpecification { + /** + * Create a MetricSpecification. + * @member {string} [name] The name of the metric. + * @member {string} [displayName] The display name of the metric. + * @member {string} [displayDescription] The description of the metric. + * @member {string} [unit] Units the metric to be displayed in. + * @member {string} [aggregationType] The aggregation type. + * @member {array} [availabilities] List of availability. + * @member {boolean} [enableRegionalMdmAccount] Whether regional MDM account + * enabled. + * @member {boolean} [fillGapWithZero] Whether gaps would be filled with + * zeros. + * @member {string} [metricFilterPattern] Pattern for the filter of the + * metric. + * @member {array} [dimensions] List of dimensions. + * @member {boolean} [isInternal] Whether the metric is internal. + * @member {string} [sourceMdmAccount] The source MDM account. + * @member {string} [sourceMdmNamespace] The source MDM namespace. + * @member {string} [resourceIdDimensionNameOverride] The resource Id + * dimension name override. + */ + constructor() { + } + + /** + * Defines the metadata of MetricSpecification + * + * @returns {object} metadata of MetricSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'MetricSpecification', + type: { + name: 'Composite', + className: 'MetricSpecification', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + displayName: { + required: false, + serializedName: 'displayName', + type: { + name: 'String' + } + }, + displayDescription: { + required: false, + serializedName: 'displayDescription', + type: { + name: 'String' + } + }, + unit: { + required: false, + serializedName: 'unit', + type: { + name: 'String' + } + }, + aggregationType: { + required: false, + serializedName: 'aggregationType', + type: { + name: 'String' + } + }, + availabilities: { + required: false, + serializedName: 'availabilities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'AvailabilityElementType', + type: { + name: 'Composite', + className: 'Availability' + } + } + } + }, + enableRegionalMdmAccount: { + required: false, + serializedName: 'enableRegionalMdmAccount', + type: { + name: 'Boolean' + } + }, + fillGapWithZero: { + required: false, + serializedName: 'fillGapWithZero', + type: { + name: 'Boolean' + } + }, + metricFilterPattern: { + required: false, + serializedName: 'metricFilterPattern', + type: { + name: 'String' + } + }, + dimensions: { + required: false, + serializedName: 'dimensions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'DimensionElementType', + type: { + name: 'Composite', + className: 'Dimension' + } + } + } + }, + isInternal: { + required: false, + serializedName: 'isInternal', + type: { + name: 'Boolean' + } + }, + sourceMdmAccount: { + required: false, + serializedName: 'sourceMdmAccount', + type: { + name: 'String' + } + }, + sourceMdmNamespace: { + required: false, + serializedName: 'sourceMdmNamespace', + type: { + name: 'String' + } + }, + resourceIdDimensionNameOverride: { + required: false, + serializedName: 'resourceIdDimensionNameOverride', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = MetricSpecification; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterface.js b/lib/services/networkManagement2/lib/lib/models/networkInterface.js new file mode 100644 index 0000000000..aab3f7b4db --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterface.js @@ -0,0 +1,233 @@ +/* + * 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'); + +/** + * A network interface in a resource group. + * + * @extends models['Resource'] + */ +class NetworkInterface extends models['Resource'] { + /** + * Create a NetworkInterface. + * @member {object} [virtualMachine] The reference of a virtual machine. + * @member {string} [virtualMachine.id] Resource ID. + * @member {object} [networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [networkSecurityGroup.defaultSecurityRules] The default + * security rules of network security group. + * @member {array} [networkSecurityGroup.networkInterfaces] A collection of + * references to network interfaces. + * @member {array} [networkSecurityGroup.subnets] A collection of references + * to subnets. + * @member {string} [networkSecurityGroup.resourceGuid] The resource GUID + * property of the network security group resource. + * @member {string} [networkSecurityGroup.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [networkSecurityGroup.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {array} [ipConfigurations] A list of IPConfigurations of the + * network interface. + * @member {object} [dnsSettings] The DNS settings in network interface. + * @member {array} [dnsSettings.dnsServers] List of DNS servers IP addresses. + * Use 'AzureProvidedDNS' to switch to azure provided DNS resolution. + * 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the + * only value in dnsServers collection. + * @member {array} [dnsSettings.appliedDnsServers] If the VM that uses this + * NIC is part of an Availability Set, then this list will have the union of + * all DNS servers from all NICs that are part of the Availability Set. This + * property is what is configured on each of those VMs. + * @member {string} [dnsSettings.internalDnsNameLabel] Relative DNS name for + * this NIC used for internal communications between VMs in the same virtual + * network. + * @member {string} [dnsSettings.internalFqdn] Fully qualified DNS name + * supporting internal communications between VMs in the same virtual + * network. + * @member {string} [dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating + * the VM name with the value of internalDomainNameSuffix. + * @member {string} [macAddress] The MAC address of the network interface. + * @member {boolean} [primary] Gets whether this is a primary network + * interface on a virtual machine. + * @member {boolean} [enableAcceleratedNetworking] If the network interface + * is accelerated networking enabled. + * @member {boolean} [enableIPForwarding] Indicates whether IP forwarding is + * enabled on this network interface. + * @member {string} [resourceGuid] The resource GUID property of the network + * interface resource. + * @member {string} [provisioningState] The provisioning state of the public + * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkInterface + * + * @returns {object} metadata of NetworkInterface + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterface', + type: { + name: 'Composite', + className: 'NetworkInterface', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + virtualMachine: { + required: false, + serializedName: 'properties.virtualMachine', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + networkSecurityGroup: { + required: false, + serializedName: 'properties.networkSecurityGroup', + type: { + name: 'Composite', + className: 'NetworkSecurityGroup' + } + }, + ipConfigurations: { + required: false, + serializedName: 'properties.ipConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceIPConfigurationElementType', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + } + } + }, + dnsSettings: { + required: false, + serializedName: 'properties.dnsSettings', + type: { + name: 'Composite', + className: 'NetworkInterfaceDnsSettings' + } + }, + macAddress: { + required: false, + serializedName: 'properties.macAddress', + type: { + name: 'String' + } + }, + primary: { + required: false, + serializedName: 'properties.primary', + type: { + name: 'Boolean' + } + }, + enableAcceleratedNetworking: { + required: false, + serializedName: 'properties.enableAcceleratedNetworking', + type: { + name: 'Boolean' + } + }, + enableIPForwarding: { + required: false, + serializedName: 'properties.enableIPForwarding', + type: { + name: 'Boolean' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterface; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceAssociation.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceAssociation.js new file mode 100644 index 0000000000..a867b7457c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceAssociation.js @@ -0,0 +1,71 @@ +/* + * 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 interface and its custom security rules. + * + */ +class NetworkInterfaceAssociation { + /** + * Create a NetworkInterfaceAssociation. + * @member {string} [id] Network interface ID. + * @member {array} [securityRules] Collection of custom security rules. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkInterfaceAssociation + * + * @returns {object} metadata of NetworkInterfaceAssociation + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceAssociation', + type: { + name: 'Composite', + className: 'NetworkInterfaceAssociation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + securityRules: { + required: false, + serializedName: 'securityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceAssociation; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceDnsSettings.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceDnsSettings.js new file mode 100644 index 0000000000..eb3373a032 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceDnsSettings.js @@ -0,0 +1,109 @@ +/* + * 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'; + +/** + * DNS settings of a network interface. + * + */ +class NetworkInterfaceDnsSettings { + /** + * Create a NetworkInterfaceDnsSettings. + * @member {array} [dnsServers] List of DNS servers IP addresses. Use + * 'AzureProvidedDNS' to switch to azure provided DNS resolution. + * 'AzureProvidedDNS' value cannot be combined with other IPs, it must be the + * only value in dnsServers collection. + * @member {array} [appliedDnsServers] If the VM that uses this NIC is part + * of an Availability Set, then this list will have the union of all DNS + * servers from all NICs that are part of the Availability Set. This property + * is what is configured on each of those VMs. + * @member {string} [internalDnsNameLabel] Relative DNS name for this NIC + * used for internal communications between VMs in the same virtual network. + * @member {string} [internalFqdn] Fully qualified DNS name supporting + * internal communications between VMs in the same virtual network. + * @member {string} [internalDomainNameSuffix] Even if internalDnsNameLabel + * is not specified, a DNS entry is created for the primary NIC of the VM. + * This DNS name can be constructed by concatenating the VM name with the + * value of internalDomainNameSuffix. + */ + constructor() { + } + + /** + * Defines the metadata of NetworkInterfaceDnsSettings + * + * @returns {object} metadata of NetworkInterfaceDnsSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceDnsSettings', + type: { + name: 'Composite', + className: 'NetworkInterfaceDnsSettings', + modelProperties: { + dnsServers: { + required: false, + serializedName: 'dnsServers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + appliedDnsServers: { + required: false, + serializedName: 'appliedDnsServers', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + internalDnsNameLabel: { + required: false, + serializedName: 'internalDnsNameLabel', + type: { + name: 'String' + } + }, + internalFqdn: { + required: false, + serializedName: 'internalFqdn', + type: { + name: 'String' + } + }, + internalDomainNameSuffix: { + required: false, + serializedName: 'internalDomainNameSuffix', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceDnsSettings; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfiguration.js new file mode 100644 index 0000000000..21466e3abc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfiguration.js @@ -0,0 +1,374 @@ +/* + * 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'); + +/** + * IPConfiguration in a network interface. + * + * @extends models['SubResource'] + */ +class NetworkInterfaceIPConfiguration extends models['SubResource'] { + /** + * Create a NetworkInterfaceIPConfiguration. + * @member {array} [applicationGatewayBackendAddressPools] The reference of + * ApplicationGatewayBackendAddressPool resource. + * @member {array} [loadBalancerBackendAddressPools] The reference of + * LoadBalancerBackendAddressPool resource. + * @member {array} [loadBalancerInboundNatRules] A list of references of + * LoadBalancerInboundNatRules. + * @member {string} [privateIPAddress] Private IP address of the IP + * configuration. + * @member {string} [privateIPAllocationMethod] Defines how a private IP + * address is assigned. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [privateIPAddressVersion] Available from Api-Version + * 2016-03-30 onwards, it represents whether the specific ipconfiguration is + * IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and + * 'IPv6'. Possible values include: 'IPv4', 'IPv6' + * @member {object} [subnet] Subnet bound to the IP configuration. + * @member {string} [subnet.addressPrefix] The address prefix for the subnet. + * @member {object} [subnet.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [subnet.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * @member {array} [subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} [subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [subnet.networkSecurityGroup.subnets] A collection of + * references to subnets. + * @member {string} [subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} [subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [subnet.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [subnet.routeTable] The reference of the RouteTable + * resource. + * @member {array} [subnet.routeTable.routes] Collection of routes contained + * within a route table. + * @member {array} [subnet.routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} [subnet.routeTable.provisioningState] The provisioning + * state of the resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [subnet.routeTable.etag] Gets a unique read-only string + * that changes whenever the resource is updated. + * @member {array} [subnet.serviceEndpoints] An array of service endpoints. + * @member {array} [subnet.ipConfigurations] Gets an array of references to + * the network interface IP configurations using subnet. + * @member {array} [subnet.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * @member {string} [subnet.provisioningState] The provisioning state of the + * resource. + * @member {string} [subnet.name] The name of the resource that is unique + * within a resource group. This name can be used to access the resource. + * @member {string} [subnet.etag] A unique read-only string that changes + * whenever the resource is updated. + * @member {boolean} [primary] Gets whether this is a primary customer + * address on the network interface. + * @member {object} [publicIPAddress] Public IP address bound to the IP + * configuration. + * @member {object} [publicIPAddress.sku] The public IP address SKU. + * @member {string} [publicIPAddress.sku.name] Name of a public IP address + * SKU. Possible values include: 'Basic', 'Standard' + * @member {string} [publicIPAddress.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {string} [publicIPAddress.publicIPAddressVersion] The public IP + * address version. Possible values are: 'IPv4' and 'IPv6'. Possible values + * include: 'IPv4', 'IPv6' + * @member {object} [publicIPAddress.ipConfiguration] The IP configuration + * associated with the public IP address. + * @member {string} [publicIPAddress.ipConfiguration.privateIPAddress] The + * private IP address of the IP configuration. + * @member {string} + * [publicIPAddress.ipConfiguration.privateIPAllocationMethod] The private IP + * allocation method. Possible values are 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {object} [publicIPAddress.ipConfiguration.subnet] The reference of + * the subnet resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.addressPrefix] + * The address prefix for the subnet. + * @member {object} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.securityRules] + * A collection of security rules of the network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] + * A collection of references to network interfaces. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.resourceGuid] + * The resource GUID property of the network security group resource. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.networkSecurityGroup.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.subnet.routeTable] The + * reference of the RouteTable resource. + * @member {array} [publicIPAddress.ipConfiguration.subnet.routeTable.routes] + * Collection of routes contained within a route table. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.routeTable.subnets] A collection + * of references to subnets. + * @member {boolean} + * [publicIPAddress.ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.subnet.routeTable.etag] + * Gets a unique read-only string that changes whenever the resource is + * updated. + * @member {array} [publicIPAddress.ipConfiguration.subnet.serviceEndpoints] + * An array of service endpoints. + * @member {array} [publicIPAddress.ipConfiguration.subnet.ipConfigurations] + * Gets an array of references to the network interface IP configurations + * using subnet. + * @member {array} + * [publicIPAddress.ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} + * [publicIPAddress.ipConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.name] The name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * @member {string} [publicIPAddress.ipConfiguration.subnet.etag] A unique + * read-only string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.ipConfiguration.publicIPAddress] The + * reference of the public IP resource. + * @member {string} [publicIPAddress.ipConfiguration.provisioningState] Gets + * the provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.ipConfiguration.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * @member {string} [publicIPAddress.ipConfiguration.etag] A unique read-only + * string that changes whenever the resource is updated. + * @member {object} [publicIPAddress.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * @member {string} [publicIPAddress.dnsSettings.domainNameLabel] Gets or + * sets the Domain name label.The concatenation of the domain name label and + * the regionalized DNS zone make up the fully qualified domain name + * associated with the public IP address. If a domain name label is + * specified, an A DNS record is created for the public IP in the Microsoft + * Azure DNS system. + * @member {string} [publicIPAddress.dnsSettings.fqdn] Gets the FQDN, Fully + * qualified domain name of the A DNS record associated with the public IP. + * This is the concatenation of the domainNameLabel and the regionalized DNS + * zone. + * @member {string} [publicIPAddress.dnsSettings.reverseFqdn] Gets or Sets + * the Reverse FQDN. A user-visible, fully qualified domain name that + * resolves to this public IP address. If the reverseFqdn is specified, then + * a PTR DNS record is created pointing from the IP address in the + * in-addr.arpa domain to the reverse FQDN. + * @member {array} [publicIPAddress.ipTags] The list of tags associated with + * the public IP address. + * @member {string} [publicIPAddress.ipAddress] The IP address associated + * with the public IP address resource. + * @member {number} [publicIPAddress.idleTimeoutInMinutes] The idle timeout + * of the public IP address. + * @member {string} [publicIPAddress.resourceGuid] The resource GUID property + * of the public IP resource. + * @member {string} [publicIPAddress.provisioningState] The provisioning + * state of the PublicIP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [publicIPAddress.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {array} [publicIPAddress.zones] A list of availability zones + * denoting the IP allocated for the resource needs to come from. + * @member {array} [applicationSecurityGroups] Application security groups in + * which the IP configuration is included. + * @member {string} [provisioningState] The provisioning state of the network + * interface IP configuration. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkInterfaceIPConfiguration + * + * @returns {object} metadata of NetworkInterfaceIPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceIPConfiguration', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + applicationGatewayBackendAddressPools: { + required: false, + serializedName: 'properties.applicationGatewayBackendAddressPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationGatewayBackendAddressPoolElementType', + type: { + name: 'Composite', + className: 'ApplicationGatewayBackendAddressPool' + } + } + } + }, + loadBalancerBackendAddressPools: { + required: false, + serializedName: 'properties.loadBalancerBackendAddressPools', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'BackendAddressPoolElementType', + type: { + name: 'Composite', + className: 'BackendAddressPool' + } + } + } + }, + loadBalancerInboundNatRules: { + required: false, + serializedName: 'properties.loadBalancerInboundNatRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'InboundNatRuleElementType', + type: { + name: 'Composite', + className: 'InboundNatRule' + } + } + } + }, + privateIPAddress: { + required: false, + serializedName: 'properties.privateIPAddress', + type: { + name: 'String' + } + }, + privateIPAllocationMethod: { + required: false, + serializedName: 'properties.privateIPAllocationMethod', + type: { + name: 'String' + } + }, + privateIPAddressVersion: { + required: false, + serializedName: 'properties.privateIPAddressVersion', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'Subnet' + } + }, + primary: { + required: false, + serializedName: 'properties.primary', + type: { + name: 'Boolean' + } + }, + publicIPAddress: { + required: false, + serializedName: 'properties.publicIPAddress', + type: { + name: 'Composite', + className: 'PublicIPAddress' + } + }, + applicationSecurityGroups: { + required: false, + serializedName: 'properties.applicationSecurityGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationSecurityGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroup' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceIPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfigurationListResult.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfigurationListResult.js new file mode 100644 index 0000000000..af962fd6bc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceIPConfigurationListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for list ip configurations API service call. + */ +class NetworkInterfaceIPConfigurationListResult extends Array { + /** + * Create a NetworkInterfaceIPConfigurationListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkInterfaceIPConfigurationListResult + * + * @returns {object} metadata of NetworkInterfaceIPConfigurationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceIPConfigurationListResult', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfigurationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceIPConfigurationElementType', + type: { + name: 'Composite', + className: 'NetworkInterfaceIPConfiguration' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceIPConfigurationListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceListResult.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceListResult.js new file mode 100644 index 0000000000..125b569ac8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the ListNetworkInterface API service call. + */ +class NetworkInterfaceListResult extends Array { + /** + * Create a NetworkInterfaceListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkInterfaceListResult + * + * @returns {object} metadata of NetworkInterfaceListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceListResult', + type: { + name: 'Composite', + className: 'NetworkInterfaceListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceElementType', + type: { + name: 'Composite', + className: 'NetworkInterface' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/networkInterfaceLoadBalancerListResult.js b/lib/services/networkManagement2/lib/lib/models/networkInterfaceLoadBalancerListResult.js new file mode 100644 index 0000000000..c4ff846d5c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkInterfaceLoadBalancerListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for list ip configurations API service call. + */ +class NetworkInterfaceLoadBalancerListResult extends Array { + /** + * Create a NetworkInterfaceLoadBalancerListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkInterfaceLoadBalancerListResult + * + * @returns {object} metadata of NetworkInterfaceLoadBalancerListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkInterfaceLoadBalancerListResult', + type: { + name: 'Composite', + className: 'NetworkInterfaceLoadBalancerListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LoadBalancerElementType', + type: { + name: 'Composite', + className: 'LoadBalancer' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkInterfaceLoadBalancerListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/networkSecurityGroup.js b/lib/services/networkManagement2/lib/lib/models/networkSecurityGroup.js new file mode 100644 index 0000000000..9a486a39ab --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkSecurityGroup.js @@ -0,0 +1,188 @@ +/* + * 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'); + +/** + * NetworkSecurityGroup resource. + * + * @extends models['Resource'] + */ +class NetworkSecurityGroup extends models['Resource'] { + /** + * Create a NetworkSecurityGroup. + * @member {array} [securityRules] A collection of security rules of the + * network security group. + * @member {array} [defaultSecurityRules] The default security rules of + * network security group. + * @member {array} [networkInterfaces] A collection of references to network + * interfaces. + * @member {array} [subnets] A collection of references to subnets. + * @member {string} [resourceGuid] The resource GUID property of the network + * security group resource. + * @member {string} [provisioningState] The provisioning state of the public + * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkSecurityGroup + * + * @returns {object} metadata of NetworkSecurityGroup + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkSecurityGroup', + type: { + name: 'Composite', + className: 'NetworkSecurityGroup', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + securityRules: { + required: false, + serializedName: 'properties.securityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + }, + defaultSecurityRules: { + required: false, + serializedName: 'properties.defaultSecurityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + }, + networkInterfaces: { + required: false, + readOnly: true, + serializedName: 'properties.networkInterfaces', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkInterfaceElementType', + type: { + name: 'Composite', + className: 'NetworkInterface' + } + } + } + }, + subnets: { + required: false, + readOnly: true, + serializedName: 'properties.subnets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubnetElementType', + type: { + name: 'Composite', + className: 'Subnet' + } + } + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkSecurityGroup; diff --git a/lib/services/networkManagement2/lib/lib/models/networkSecurityGroupListResult.js b/lib/services/networkManagement2/lib/lib/models/networkSecurityGroupListResult.js new file mode 100644 index 0000000000..abf75b6d9d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkSecurityGroupListResult.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'; + +/** + * Response for ListNetworkSecurityGroups API service call. + */ +class NetworkSecurityGroupListResult extends Array { + /** + * Create a NetworkSecurityGroupListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkSecurityGroupListResult + * + * @returns {object} metadata of NetworkSecurityGroupListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkSecurityGroupListResult', + type: { + name: 'Composite', + className: 'NetworkSecurityGroupListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkSecurityGroupElementType', + type: { + name: 'Composite', + className: 'NetworkSecurityGroup' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkSecurityGroupListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/networkWatcher.js b/lib/services/networkManagement2/lib/lib/models/networkWatcher.js new file mode 100644 index 0000000000..2d392cef39 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkWatcher.js @@ -0,0 +1,112 @@ +/* + * 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 watcher in a resource group. + * + * @extends models['Resource'] + */ +class NetworkWatcher extends models['Resource'] { + /** + * Create a NetworkWatcher. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', + * 'Failed' + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkWatcher + * + * @returns {object} metadata of NetworkWatcher + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkWatcher', + type: { + name: 'Composite', + className: 'NetworkWatcher', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NetworkWatcher; diff --git a/lib/services/networkManagement2/lib/lib/models/networkWatcherListResult.js b/lib/services/networkManagement2/lib/lib/models/networkWatcherListResult.js new file mode 100644 index 0000000000..61b6321fc3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/networkWatcherListResult.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'; + +/** + * List of network watcher resources. + */ +class NetworkWatcherListResult extends Array { + /** + * Create a NetworkWatcherListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of NetworkWatcherListResult + * + * @returns {object} metadata of NetworkWatcherListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NetworkWatcherListResult', + type: { + name: 'Composite', + className: 'NetworkWatcherListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'NetworkWatcherElementType', + type: { + name: 'Composite', + className: 'NetworkWatcher' + } + } + } + } + } + } + }; + } +} + +module.exports = NetworkWatcherListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/nextHopParameters.js b/lib/services/networkManagement2/lib/lib/models/nextHopParameters.js new file mode 100644 index 0000000000..490154bbbb --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/nextHopParameters.js @@ -0,0 +1,79 @@ +/* + * 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 that define the source and destination endpoint. + * + */ +class NextHopParameters { + /** + * Create a NextHopParameters. + * @member {string} targetResourceId The resource identifier of the target + * resource against which the action is to be performed. + * @member {string} sourceIPAddress The source IP address. + * @member {string} destinationIPAddress The destination IP address. + * @member {string} [targetNicResourceId] The NIC ID. (If VM has multiple + * NICs and IP forwarding is enabled on any of the nics, then this parameter + * must be specified. Otherwise optional). + */ + constructor() { + } + + /** + * Defines the metadata of NextHopParameters + * + * @returns {object} metadata of NextHopParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'NextHopParameters', + type: { + name: 'Composite', + className: 'NextHopParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + }, + sourceIPAddress: { + required: true, + serializedName: 'sourceIPAddress', + type: { + name: 'String' + } + }, + destinationIPAddress: { + required: true, + serializedName: 'destinationIPAddress', + type: { + name: 'String' + } + }, + targetNicResourceId: { + required: false, + serializedName: 'targetNicResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NextHopParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/nextHopResult.js b/lib/services/networkManagement2/lib/lib/models/nextHopResult.js new file mode 100644 index 0000000000..e6717174e8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/nextHopResult.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'; + +/** + * The information about next hop from the specified VM. + * + */ +class NextHopResult { + /** + * Create a NextHopResult. + * @member {string} [nextHopType] Next hop type. Possible values include: + * 'Internet', 'VirtualAppliance', 'VirtualNetworkGateway', 'VnetLocal', + * 'HyperNetGateway', 'None' + * @member {string} [nextHopIpAddress] Next hop IP Address + * @member {string} [routeTableId] The resource identifier for the route + * table associated with the route being returned. If the route being + * returned does not correspond to any user created routes then this field + * will be the string 'System Route'. + */ + constructor() { + } + + /** + * Defines the metadata of NextHopResult + * + * @returns {object} metadata of NextHopResult + * + */ + mapper() { + return { + required: false, + serializedName: 'NextHopResult', + type: { + name: 'Composite', + className: 'NextHopResult', + modelProperties: { + nextHopType: { + required: false, + serializedName: 'nextHopType', + type: { + name: 'String' + } + }, + nextHopIpAddress: { + required: false, + serializedName: 'nextHopIpAddress', + type: { + name: 'String' + } + }, + routeTableId: { + required: false, + serializedName: 'routeTableId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = NextHopResult; diff --git a/lib/services/networkManagement2/lib/lib/models/operation.js b/lib/services/networkManagement2/lib/lib/models/operation.js new file mode 100644 index 0000000000..61fb880599 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/operation.js @@ -0,0 +1,90 @@ +/* + * 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 REST API operation definition. + * + */ +class Operation { + /** + * Create a Operation. + * @member {string} [name] Operation name: {provider}/{resource}/{operation} + * @member {object} [display] Display metadata associated with the operation. + * @member {string} [display.provider] Service provider: Microsoft Network. + * @member {string} [display.resource] Resource on which the operation is + * performed. + * @member {string} [display.operation] Type of the operation: get, read, + * delete, etc. + * @member {string} [display.description] Description of the operation. + * @member {string} [origin] Origin of the operation. + * @member {object} [serviceSpecification] Specification of the service. + * @member {array} [serviceSpecification.metricSpecifications] Operation + * service specification. + * @member {array} [serviceSpecification.logSpecifications] Operation log + * specification. + */ + constructor() { + } + + /** + * Defines the metadata of Operation + * + * @returns {object} metadata of Operation + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation', + type: { + name: 'Composite', + className: 'Operation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + display: { + required: false, + serializedName: 'display', + type: { + name: 'Composite', + className: 'OperationDisplay' + } + }, + origin: { + required: false, + serializedName: 'origin', + type: { + name: 'String' + } + }, + serviceSpecification: { + required: false, + serializedName: 'properties.serviceSpecification', + type: { + name: 'Composite', + className: 'OperationPropertiesFormatServiceSpecification' + } + } + } + } + }; + } +} + +module.exports = Operation; diff --git a/lib/services/networkManagement2/lib/lib/models/operationDisplay.js b/lib/services/networkManagement2/lib/lib/models/operationDisplay.js new file mode 100644 index 0000000000..da0bff9211 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/operationDisplay.js @@ -0,0 +1,77 @@ +/* + * 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'; + +/** + * Display metadata associated with the operation. + * + */ +class OperationDisplay { + /** + * Create a OperationDisplay. + * @member {string} [provider] Service provider: Microsoft Network. + * @member {string} [resource] Resource on which the operation is performed. + * @member {string} [operation] Type of the operation: get, read, delete, + * etc. + * @member {string} [description] Description of the operation. + */ + constructor() { + } + + /** + * Defines the metadata of OperationDisplay + * + * @returns {object} metadata of OperationDisplay + * + */ + mapper() { + return { + required: false, + serializedName: 'Operation_display', + type: { + name: 'Composite', + className: 'OperationDisplay', + modelProperties: { + provider: { + required: false, + serializedName: 'provider', + type: { + name: 'String' + } + }, + resource: { + required: false, + serializedName: 'resource', + type: { + name: 'String' + } + }, + operation: { + required: false, + serializedName: 'operation', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'description', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationDisplay; diff --git a/lib/services/networkManagement2/lib/lib/models/operationListResult.js b/lib/services/networkManagement2/lib/lib/models/operationListResult.js new file mode 100644 index 0000000000..cdcc6ce3c6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/operationListResult.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Result of the request to list Network operations. It contains a list of + * operations and a URL link to get the next set of results. + */ +class OperationListResult extends Array { + /** + * Create a OperationListResult. + * @member {string} [nextLink] URL to get the next set of operation list + * results if there are any. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OperationListResult + * + * @returns {object} metadata of OperationListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationListResult', + type: { + name: 'Composite', + className: 'OperationListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'OperationElementType', + type: { + name: 'Composite', + className: 'Operation' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OperationListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/operationPropertiesFormatServiceSpecification.js b/lib/services/networkManagement2/lib/lib/models/operationPropertiesFormatServiceSpecification.js new file mode 100644 index 0000000000..74aec12973 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/operationPropertiesFormatServiceSpecification.js @@ -0,0 +1,78 @@ +/* + * 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'); + +/** + * Specification of the service. + * + */ +class OperationPropertiesFormatServiceSpecification { + /** + * Create a OperationPropertiesFormatServiceSpecification. + * @member {array} [metricSpecifications] Operation service specification. + * @member {array} [logSpecifications] Operation log specification. + */ + constructor() { + } + + /** + * Defines the metadata of OperationPropertiesFormatServiceSpecification + * + * @returns {object} metadata of OperationPropertiesFormatServiceSpecification + * + */ + mapper() { + return { + required: false, + serializedName: 'OperationPropertiesFormat_serviceSpecification', + type: { + name: 'Composite', + className: 'OperationPropertiesFormatServiceSpecification', + modelProperties: { + metricSpecifications: { + required: false, + serializedName: 'metricSpecifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'MetricSpecificationElementType', + type: { + name: 'Composite', + className: 'MetricSpecification' + } + } + } + }, + logSpecifications: { + required: false, + serializedName: 'logSpecifications', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'LogSpecificationElementType', + type: { + name: 'Composite', + className: 'LogSpecification' + } + } + } + } + } + } + }; + } +} + +module.exports = OperationPropertiesFormatServiceSpecification; diff --git a/lib/services/networkManagement2/lib/lib/models/outboundNatRule.js b/lib/services/networkManagement2/lib/lib/models/outboundNatRule.js new file mode 100644 index 0000000000..33e85d3a09 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/outboundNatRule.js @@ -0,0 +1,120 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Outbound NAT pool of the load balancer. + * + * @extends models['SubResource'] + */ +class OutboundNatRule extends models['SubResource'] { + /** + * Create a OutboundNatRule. + * @member {number} [allocatedOutboundPorts] The number of outbound ports to + * be used for NAT. + * @member {array} [frontendIPConfigurations] The Frontend IP addresses of + * the load balancer. + * @member {object} backendAddressPool A reference to a pool of DIPs. + * Outbound traffic is randomly load balanced across IPs in the backend IPs. + * @member {string} [backendAddressPool.id] Resource ID. + * @member {string} [provisioningState] Gets the provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of OutboundNatRule + * + * @returns {object} metadata of OutboundNatRule + * + */ + mapper() { + return { + required: false, + serializedName: 'OutboundNatRule', + type: { + name: 'Composite', + className: 'OutboundNatRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + allocatedOutboundPorts: { + required: false, + serializedName: 'properties.allocatedOutboundPorts', + type: { + name: 'Number' + } + }, + frontendIPConfigurations: { + required: false, + serializedName: 'properties.frontendIPConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + backendAddressPool: { + required: true, + serializedName: 'properties.backendAddressPool', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = OutboundNatRule; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCapture.js b/lib/services/networkManagement2/lib/lib/models/packetCapture.js new file mode 100644 index 0000000000..3723749592 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCapture.js @@ -0,0 +1,120 @@ +/* + * 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 that define the create packet capture operation. + * + */ +class PacketCapture { + /** + * Create a PacketCapture. + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture + * output. Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage + * ID is provided, otherwise optional. + * @member {array} [filters] + */ + constructor() { + } + + /** + * Defines the metadata of PacketCapture + * + * @returns {object} metadata of PacketCapture + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCapture', + type: { + name: 'Composite', + className: 'PacketCapture', + modelProperties: { + target: { + required: true, + serializedName: 'properties.target', + type: { + name: 'String' + } + }, + bytesToCapturePerPacket: { + required: false, + serializedName: 'properties.bytesToCapturePerPacket', + defaultValue: 0, + type: { + name: 'Number' + } + }, + totalBytesPerSession: { + required: false, + serializedName: 'properties.totalBytesPerSession', + defaultValue: 1073741824, + type: { + name: 'Number' + } + }, + timeLimitInSeconds: { + required: false, + serializedName: 'properties.timeLimitInSeconds', + defaultValue: 18000, + type: { + name: 'Number' + } + }, + storageLocation: { + required: true, + serializedName: 'properties.storageLocation', + type: { + name: 'Composite', + className: 'PacketCaptureStorageLocation' + } + }, + filters: { + required: false, + serializedName: 'properties.filters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PacketCaptureFilterElementType', + type: { + name: 'Composite', + className: 'PacketCaptureFilter' + } + } + } + } + } + } + }; + } +} + +module.exports = PacketCapture; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureFilter.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureFilter.js new file mode 100644 index 0000000000..fd13922bb6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureFilter.js @@ -0,0 +1,101 @@ +/* + * 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'; + +/** + * Filter that is applied to packet capture request. Multiple filters can be + * applied. + * + */ +class PacketCaptureFilter { + /** + * Create a PacketCaptureFilter. + * @member {string} [protocol] Protocol to be filtered on. Possible values + * include: 'TCP', 'UDP', 'Any'. Default value: 'Any' . + * @member {string} [localIPAddress] Local IP Address to be filtered on. + * Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" + * for range. "127.0.0.1;127.0.0.5"? for multiple entries. Multiple ranges + * not currently supported. Mixing ranges with multiple entries not currently + * supported. Default = null. + * @member {string} [remoteIPAddress] Local IP Address to be filtered on. + * Notation: "127.0.0.1" for single address entry. "127.0.0.1-127.0.0.255" + * for range. "127.0.0.1;127.0.0.5;" for multiple entries. Multiple ranges + * not currently supported. Mixing ranges with multiple entries not currently + * supported. Default = null. + * @member {string} [localPort] Local port to be filtered on. Notation: "80" + * for single port entry."80-85" for range. "80;443;" for multiple entries. + * Multiple ranges not currently supported. Mixing ranges with multiple + * entries not currently supported. Default = null. + * @member {string} [remotePort] Remote port to be filtered on. Notation: + * "80" for single port entry."80-85" for range. "80;443;" for multiple + * entries. Multiple ranges not currently supported. Mixing ranges with + * multiple entries not currently supported. Default = null. + */ + constructor() { + } + + /** + * Defines the metadata of PacketCaptureFilter + * + * @returns {object} metadata of PacketCaptureFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureFilter', + type: { + name: 'Composite', + className: 'PacketCaptureFilter', + modelProperties: { + protocol: { + required: false, + serializedName: 'protocol', + defaultValue: 'Any', + type: { + name: 'String' + } + }, + localIPAddress: { + required: false, + serializedName: 'localIPAddress', + type: { + name: 'String' + } + }, + remoteIPAddress: { + required: false, + serializedName: 'remoteIPAddress', + type: { + name: 'String' + } + }, + localPort: { + required: false, + serializedName: 'localPort', + type: { + name: 'String' + } + }, + remotePort: { + required: false, + serializedName: 'remotePort', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PacketCaptureFilter; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureListResult.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureListResult.js new file mode 100644 index 0000000000..83e0404f31 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureListResult.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'; + +/** + * List of packet capture sessions. + */ +class PacketCaptureListResult extends Array { + /** + * Create a PacketCaptureListResult. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PacketCaptureListResult + * + * @returns {object} metadata of PacketCaptureListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureListResult', + type: { + name: 'Composite', + className: 'PacketCaptureListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PacketCaptureResultElementType', + type: { + name: 'Composite', + className: 'PacketCaptureResult' + } + } + } + } + } + } + }; + } +} + +module.exports = PacketCaptureListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureParameters.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureParameters.js new file mode 100644 index 0000000000..01c24e2b0f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureParameters.js @@ -0,0 +1,120 @@ +/* + * 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 that define the create packet capture operation. + * + */ +class PacketCaptureParameters { + /** + * Create a PacketCaptureParameters. + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture + * output. Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage + * ID is provided, otherwise optional. + * @member {array} [filters] + */ + constructor() { + } + + /** + * Defines the metadata of PacketCaptureParameters + * + * @returns {object} metadata of PacketCaptureParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureParameters', + type: { + name: 'Composite', + className: 'PacketCaptureParameters', + modelProperties: { + target: { + required: true, + serializedName: 'target', + type: { + name: 'String' + } + }, + bytesToCapturePerPacket: { + required: false, + serializedName: 'bytesToCapturePerPacket', + defaultValue: 0, + type: { + name: 'Number' + } + }, + totalBytesPerSession: { + required: false, + serializedName: 'totalBytesPerSession', + defaultValue: 1073741824, + type: { + name: 'Number' + } + }, + timeLimitInSeconds: { + required: false, + serializedName: 'timeLimitInSeconds', + defaultValue: 18000, + type: { + name: 'Number' + } + }, + storageLocation: { + required: true, + serializedName: 'storageLocation', + type: { + name: 'Composite', + className: 'PacketCaptureStorageLocation' + } + }, + filters: { + required: false, + serializedName: 'filters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PacketCaptureFilterElementType', + type: { + name: 'Composite', + className: 'PacketCaptureFilter' + } + } + } + } + } + } + }; + } +} + +module.exports = PacketCaptureParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureQueryStatusResult.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureQueryStatusResult.js new file mode 100644 index 0000000000..e504224120 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureQueryStatusResult.js @@ -0,0 +1,104 @@ +/* + * 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'; + +/** + * Status of packet capture session. + * + */ +class PacketCaptureQueryStatusResult { + /** + * Create a PacketCaptureQueryStatusResult. + * @member {string} [name] The name of the packet capture resource. + * @member {string} [id] The ID of the packet capture resource. + * @member {date} [captureStartTime] The start time of the packet capture + * session. + * @member {string} [packetCaptureStatus] The status of the packet capture + * session. Possible values include: 'NotStarted', 'Running', 'Stopped', + * 'Error', 'Unknown' + * @member {string} [stopReason] The reason the current packet capture + * session was stopped. + * @member {array} [packetCaptureError] List of errors of packet capture + * session. + */ + constructor() { + } + + /** + * Defines the metadata of PacketCaptureQueryStatusResult + * + * @returns {object} metadata of PacketCaptureQueryStatusResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureQueryStatusResult', + type: { + name: 'Composite', + className: 'PacketCaptureQueryStatusResult', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + captureStartTime: { + required: false, + serializedName: 'captureStartTime', + type: { + name: 'DateTime' + } + }, + packetCaptureStatus: { + required: false, + serializedName: 'packetCaptureStatus', + type: { + name: 'String' + } + }, + stopReason: { + required: false, + serializedName: 'stopReason', + type: { + name: 'String' + } + }, + packetCaptureError: { + required: false, + serializedName: 'packetCaptureError', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = PacketCaptureQueryStatusResult; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureResult.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureResult.js new file mode 100644 index 0000000000..a4ecc1549f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureResult.js @@ -0,0 +1,158 @@ +/* + * 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'); + +/** + * Information about packet capture session. + * + */ +class PacketCaptureResult { + /** + * Create a PacketCaptureResult. + * @member {string} [name] Name of the packet capture session. + * @member {string} [id] ID of the packet capture operation. + * @member {string} [etag] Default value: 'A unique read-only string that + * changes whenever the resource is updated.' . + * @member {string} target The ID of the targeted resource, only VM is + * currently supported. + * @member {number} [bytesToCapturePerPacket] Number of bytes captured per + * packet, the remaining bytes are truncated. Default value: 0 . + * @member {number} [totalBytesPerSession] Maximum size of the capture + * output. Default value: 1073741824 . + * @member {number} [timeLimitInSeconds] Maximum duration of the capture + * session in seconds. Default value: 18000 . + * @member {object} storageLocation + * @member {string} [storageLocation.storageId] The ID of the storage account + * to save the packet capture session. Required if no local file path is + * provided. + * @member {string} [storageLocation.storagePath] The URI of the storage path + * to save the packet capture. Must be a well-formed URI describing the + * location to save the packet capture. + * @member {string} [storageLocation.filePath] A valid local path on the + * targeting VM. Must include the name of the capture file (*.cap). For linux + * virtual machine it must start with /var/captures. Required if no storage + * ID is provided, otherwise optional. + * @member {array} [filters] + * @member {string} [provisioningState] The provisioning state of the packet + * capture session. Possible values include: 'Succeeded', 'Updating', + * 'Deleting', 'Failed' + */ + constructor() { + } + + /** + * Defines the metadata of PacketCaptureResult + * + * @returns {object} metadata of PacketCaptureResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureResult', + type: { + name: 'Composite', + className: 'PacketCaptureResult', + modelProperties: { + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + defaultValue: 'A unique read-only string that changes whenever the resource is updated.', + type: { + name: 'String' + } + }, + target: { + required: true, + serializedName: 'properties.target', + type: { + name: 'String' + } + }, + bytesToCapturePerPacket: { + required: false, + serializedName: 'properties.bytesToCapturePerPacket', + defaultValue: 0, + type: { + name: 'Number' + } + }, + totalBytesPerSession: { + required: false, + serializedName: 'properties.totalBytesPerSession', + defaultValue: 1073741824, + type: { + name: 'Number' + } + }, + timeLimitInSeconds: { + required: false, + serializedName: 'properties.timeLimitInSeconds', + defaultValue: 18000, + type: { + name: 'Number' + } + }, + storageLocation: { + required: true, + serializedName: 'properties.storageLocation', + type: { + name: 'Composite', + className: 'PacketCaptureStorageLocation' + } + }, + filters: { + required: false, + serializedName: 'properties.filters', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PacketCaptureFilterElementType', + type: { + name: 'Composite', + className: 'PacketCaptureFilter' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PacketCaptureResult; diff --git a/lib/services/networkManagement2/lib/lib/models/packetCaptureStorageLocation.js b/lib/services/networkManagement2/lib/lib/models/packetCaptureStorageLocation.js new file mode 100644 index 0000000000..1661120018 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/packetCaptureStorageLocation.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'; + +/** + * Describes the storage location for a packet capture session. + * + */ +class PacketCaptureStorageLocation { + /** + * Create a PacketCaptureStorageLocation. + * @member {string} [storageId] The ID of the storage account to save the + * packet capture session. Required if no local file path is provided. + * @member {string} [storagePath] The URI of the storage path to save the + * packet capture. Must be a well-formed URI describing the location to save + * the packet capture. + * @member {string} [filePath] A valid local path on the targeting VM. Must + * include the name of the capture file (*.cap). For linux virtual machine it + * must start with /var/captures. Required if no storage ID is provided, + * otherwise optional. + */ + constructor() { + } + + /** + * Defines the metadata of PacketCaptureStorageLocation + * + * @returns {object} metadata of PacketCaptureStorageLocation + * + */ + mapper() { + return { + required: false, + serializedName: 'PacketCaptureStorageLocation', + type: { + name: 'Composite', + className: 'PacketCaptureStorageLocation', + modelProperties: { + storageId: { + required: false, + serializedName: 'storageId', + type: { + name: 'String' + } + }, + storagePath: { + required: false, + serializedName: 'storagePath', + type: { + name: 'String' + } + }, + filePath: { + required: false, + serializedName: 'filePath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PacketCaptureStorageLocation; diff --git a/lib/services/networkManagement2/lib/lib/models/patchRouteFilter.js b/lib/services/networkManagement2/lib/lib/models/patchRouteFilter.js new file mode 100644 index 0000000000..4765da6f2b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/patchRouteFilter.js @@ -0,0 +1,144 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * Route Filter Resource. + * + * @extends models['SubResource'] + */ +class PatchRouteFilter extends models['SubResource'] { + /** + * Create a PatchRouteFilter. + * @member {array} [rules] Collection of RouteFilterRules contained within a + * route filter. + * @member {array} [peerings] A collection of references to express route + * circuit peerings. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {string} [type] Resource type. + * @member {object} [tags] Resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PatchRouteFilter + * + * @returns {object} metadata of PatchRouteFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'PatchRouteFilter', + type: { + name: 'Composite', + className: 'PatchRouteFilter', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + rules: { + required: false, + serializedName: 'properties.rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteFilterRuleElementType', + type: { + name: 'Composite', + className: 'RouteFilterRule' + } + } + } + }, + peerings: { + required: false, + serializedName: 'properties.peerings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeering' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = PatchRouteFilter; diff --git a/lib/services/networkManagement2/lib/lib/models/patchRouteFilterRule.js b/lib/services/networkManagement2/lib/lib/models/patchRouteFilterRule.js new file mode 100644 index 0000000000..2a576e68a4 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/patchRouteFilterRule.js @@ -0,0 +1,120 @@ +/* + * 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'); + +/** + * Route Filter Rule Resource + * + * @extends models['SubResource'] + */ +class PatchRouteFilterRule extends models['SubResource'] { + /** + * Create a PatchRouteFilterRule. + * @member {string} access The access type of the rule. Valid values are: + * 'Allow', 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} communities The collection for bgp community values to + * filter on. e.g. ['12076:5010','12076:5020'] + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PatchRouteFilterRule + * + * @returns {object} metadata of PatchRouteFilterRule + * + */ + mapper() { + return { + required: false, + serializedName: 'PatchRouteFilterRule', + type: { + name: 'Composite', + className: 'PatchRouteFilterRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + access: { + required: true, + serializedName: 'properties.access', + type: { + name: 'String' + } + }, + routeFilterRuleType: { + required: true, + isConstant: true, + serializedName: 'properties.routeFilterRuleType', + defaultValue: 'Community', + type: { + name: 'String' + } + }, + communities: { + required: true, + serializedName: 'properties.communities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PatchRouteFilterRule; diff --git a/lib/services/networkManagement2/lib/lib/models/probe.js b/lib/services/networkManagement2/lib/lib/models/probe.js new file mode 100644 index 0000000000..667f984b64 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/probe.js @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * A load balancer probe. + * + * @extends models['SubResource'] + */ +class Probe extends models['SubResource'] { + /** + * Create a Probe. + * @member {array} [loadBalancingRules] The load balancer rules that use this + * probe. + * @member {string} protocol The protocol of the end point. Possible values + * are: 'Http' or 'Tcp'. If 'Tcp' is specified, a received ACK is required + * for the probe to be successful. If 'Http' is specified, a 200 OK response + * from the specifies URI is required for the probe to be successful. + * Possible values include: 'Http', 'Tcp' + * @member {number} port The port for communicating the probe. Possible + * values range from 1 to 65535, inclusive. + * @member {number} [intervalInSeconds] The interval, in seconds, for how + * frequently to probe the endpoint for health status. Typically, the + * interval is slightly less than half the allocated timeout period (in + * seconds) which allows two full probes before taking the instance out of + * rotation. The default value is 15, the minimum value is 5. + * @member {number} [numberOfProbes] The number of probes where if no + * response, will result in stopping further traffic from being delivered to + * the endpoint. This values allows endpoints to be taken out of rotation + * faster or slower than the typical times used in Azure. + * @member {string} [requestPath] The URI used for requesting health status + * from the VM. Path is required if a protocol is set to http. Otherwise, it + * is not allowed. There is no default value. + * @member {string} [provisioningState] Gets the provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [name] Gets name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Probe + * + * @returns {object} metadata of Probe + * + */ + mapper() { + return { + required: false, + serializedName: 'Probe', + type: { + name: 'Composite', + className: 'Probe', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + loadBalancingRules: { + required: false, + readOnly: true, + serializedName: 'properties.loadBalancingRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubResourceElementType', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + }, + protocol: { + required: true, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + port: { + required: true, + serializedName: 'properties.port', + type: { + name: 'Number' + } + }, + intervalInSeconds: { + required: false, + serializedName: 'properties.intervalInSeconds', + type: { + name: 'Number' + } + }, + numberOfProbes: { + required: false, + serializedName: 'properties.numberOfProbes', + type: { + name: 'Number' + } + }, + requestPath: { + required: false, + serializedName: 'properties.requestPath', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Probe; diff --git a/lib/services/networkManagement2/lib/lib/models/publicIPAddress.js b/lib/services/networkManagement2/lib/lib/models/publicIPAddress.js new file mode 100644 index 0000000000..343142c9ae --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/publicIPAddress.js @@ -0,0 +1,305 @@ +/* + * 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'); + +/** + * Public IP address resource. + * + * @extends models['Resource'] + */ +class PublicIPAddress extends models['Resource'] { + /** + * Create a PublicIPAddress. + * @member {object} [sku] The public IP address SKU. + * @member {string} [sku.name] Name of a public IP address SKU. Possible + * values include: 'Basic', 'Standard' + * @member {string} [publicIPAllocationMethod] The public IP allocation + * method. Possible values are: 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {string} [publicIPAddressVersion] The public IP address version. + * Possible values are: 'IPv4' and 'IPv6'. Possible values include: 'IPv4', + * 'IPv6' + * @member {object} [ipConfiguration] The IP configuration associated with + * the public IP address. + * @member {string} [ipConfiguration.privateIPAddress] The private IP address + * of the IP configuration. + * @member {string} [ipConfiguration.privateIPAllocationMethod] The private + * IP allocation method. Possible values are 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * @member {object} [ipConfiguration.subnet] The reference of the subnet + * resource. + * @member {string} [ipConfiguration.subnet.addressPrefix] The address prefix + * for the subnet. + * @member {object} [ipConfiguration.subnet.networkSecurityGroup] The + * reference of the NetworkSecurityGroup resource. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * @member {array} + * [ipConfiguration.subnet.networkSecurityGroup.networkInterfaces] A + * collection of references to network interfaces. + * @member {array} [ipConfiguration.subnet.networkSecurityGroup.subnets] A + * collection of references to subnets. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * @member {string} + * [ipConfiguration.subnet.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.networkSecurityGroup.etag] A + * unique read-only string that changes whenever the resource is updated. + * @member {object} [ipConfiguration.subnet.routeTable] The reference of the + * RouteTable resource. + * @member {array} [ipConfiguration.subnet.routeTable.routes] Collection of + * routes contained within a route table. + * @member {array} [ipConfiguration.subnet.routeTable.subnets] A collection + * of references to subnets. + * @member {boolean} + * [ipConfiguration.subnet.routeTable.disableBgpRoutePropagation] Gets or + * sets whether to disable the routes learned by BGP on that route table. + * True means disable. + * @member {string} [ipConfiguration.subnet.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.subnet.routeTable.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * @member {array} [ipConfiguration.subnet.serviceEndpoints] An array of + * service endpoints. + * @member {array} [ipConfiguration.subnet.ipConfigurations] Gets an array of + * references to the network interface IP configurations using subnet. + * @member {array} [ipConfiguration.subnet.resourceNavigationLinks] Gets an + * array of references to the external resources using subnet. + * @member {string} [ipConfiguration.subnet.provisioningState] The + * provisioning state of the resource. + * @member {string} [ipConfiguration.subnet.name] The name of the resource + * that is unique within a resource group. This name can be used to access + * the resource. + * @member {string} [ipConfiguration.subnet.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {object} [ipConfiguration.publicIPAddress] The reference of the + * public IP resource. + * @member {string} [ipConfiguration.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [ipConfiguration.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * @member {string} [ipConfiguration.etag] A unique read-only string that + * changes whenever the resource is updated. + * @member {object} [dnsSettings] The FQDN of the DNS record associated with + * the public IP address. + * @member {string} [dnsSettings.domainNameLabel] Gets or sets the Domain + * name label.The concatenation of the domain name label and the regionalized + * DNS zone make up the fully qualified domain name associated with the + * public IP address. If a domain name label is specified, an A DNS record is + * created for the public IP in the Microsoft Azure DNS system. + * @member {string} [dnsSettings.fqdn] Gets the FQDN, Fully qualified domain + * name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * @member {string} [dnsSettings.reverseFqdn] Gets or Sets the Reverse FQDN. + * A user-visible, fully qualified domain name that resolves to this public + * IP address. If the reverseFqdn is specified, then a PTR DNS record is + * created pointing from the IP address in the in-addr.arpa domain to the + * reverse FQDN. + * @member {array} [ipTags] The list of tags associated with the public IP + * address. + * @member {string} [ipAddress] The IP address associated with the public IP + * address resource. + * @member {number} [idleTimeoutInMinutes] The idle timeout of the public IP + * address. + * @member {string} [resourceGuid] The resource GUID property of the public + * IP resource. + * @member {string} [provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + * @member {array} [zones] A list of availability zones denoting the IP + * allocated for the resource needs to come from. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PublicIPAddress + * + * @returns {object} metadata of PublicIPAddress + * + */ + mapper() { + return { + required: false, + serializedName: 'PublicIPAddress', + type: { + name: 'Composite', + className: 'PublicIPAddress', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sku: { + required: false, + serializedName: 'sku', + type: { + name: 'Composite', + className: 'PublicIPAddressSku' + } + }, + publicIPAllocationMethod: { + required: false, + serializedName: 'properties.publicIPAllocationMethod', + type: { + name: 'String' + } + }, + publicIPAddressVersion: { + required: false, + serializedName: 'properties.publicIPAddressVersion', + type: { + name: 'String' + } + }, + ipConfiguration: { + required: false, + readOnly: true, + serializedName: 'properties.ipConfiguration', + type: { + name: 'Composite', + className: 'IPConfiguration' + } + }, + dnsSettings: { + required: false, + serializedName: 'properties.dnsSettings', + type: { + name: 'Composite', + className: 'PublicIPAddressDnsSettings' + } + }, + ipTags: { + required: false, + serializedName: 'properties.ipTags', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IpTagElementType', + type: { + name: 'Composite', + className: 'IpTag' + } + } + } + }, + ipAddress: { + required: false, + serializedName: 'properties.ipAddress', + type: { + name: 'String' + } + }, + idleTimeoutInMinutes: { + required: false, + serializedName: 'properties.idleTimeoutInMinutes', + type: { + name: 'Number' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + }, + zones: { + required: false, + serializedName: 'zones', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = PublicIPAddress; diff --git a/lib/services/networkManagement2/lib/lib/models/publicIPAddressDnsSettings.js b/lib/services/networkManagement2/lib/lib/models/publicIPAddressDnsSettings.js new file mode 100644 index 0000000000..1381dca87a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/publicIPAddressDnsSettings.js @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * Contains FQDN of the DNS record associated with the public IP address + * + */ +class PublicIPAddressDnsSettings { + /** + * Create a PublicIPAddressDnsSettings. + * @member {string} [domainNameLabel] Gets or sets the Domain name label.The + * concatenation of the domain name label and the regionalized DNS zone make + * up the fully qualified domain name associated with the public IP address. + * If a domain name label is specified, an A DNS record is created for the + * public IP in the Microsoft Azure DNS system. + * @member {string} [fqdn] Gets the FQDN, Fully qualified domain name of the + * A DNS record associated with the public IP. This is the concatenation of + * the domainNameLabel and the regionalized DNS zone. + * @member {string} [reverseFqdn] Gets or Sets the Reverse FQDN. A + * user-visible, fully qualified domain name that resolves to this public IP + * address. If the reverseFqdn is specified, then a PTR DNS record is created + * pointing from the IP address in the in-addr.arpa domain to the reverse + * FQDN. + */ + constructor() { + } + + /** + * Defines the metadata of PublicIPAddressDnsSettings + * + * @returns {object} metadata of PublicIPAddressDnsSettings + * + */ + mapper() { + return { + required: false, + serializedName: 'PublicIPAddressDnsSettings', + type: { + name: 'Composite', + className: 'PublicIPAddressDnsSettings', + modelProperties: { + domainNameLabel: { + required: false, + serializedName: 'domainNameLabel', + type: { + name: 'String' + } + }, + fqdn: { + required: false, + serializedName: 'fqdn', + type: { + name: 'String' + } + }, + reverseFqdn: { + required: false, + serializedName: 'reverseFqdn', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PublicIPAddressDnsSettings; diff --git a/lib/services/networkManagement2/lib/lib/models/publicIPAddressListResult.js b/lib/services/networkManagement2/lib/lib/models/publicIPAddressListResult.js new file mode 100644 index 0000000000..5545b55f0b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/publicIPAddressListResult.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'; + +/** + * Response for ListPublicIpAddresses API service call. + */ +class PublicIPAddressListResult extends Array { + /** + * Create a PublicIPAddressListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of PublicIPAddressListResult + * + * @returns {object} metadata of PublicIPAddressListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'PublicIPAddressListResult', + type: { + name: 'Composite', + className: 'PublicIPAddressListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'PublicIPAddressElementType', + type: { + name: 'Composite', + className: 'PublicIPAddress' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PublicIPAddressListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/publicIPAddressSku.js b/lib/services/networkManagement2/lib/lib/models/publicIPAddressSku.js new file mode 100644 index 0000000000..c3198b0439 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/publicIPAddressSku.js @@ -0,0 +1,53 @@ +/* + * 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'; + +/** + * SKU of a public IP address + * + */ +class PublicIPAddressSku { + /** + * Create a PublicIPAddressSku. + * @member {string} [name] Name of a public IP address SKU. Possible values + * include: 'Basic', 'Standard' + */ + constructor() { + } + + /** + * Defines the metadata of PublicIPAddressSku + * + * @returns {object} metadata of PublicIPAddressSku + * + */ + mapper() { + return { + required: false, + serializedName: 'PublicIPAddressSku', + type: { + name: 'Composite', + className: 'PublicIPAddressSku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = PublicIPAddressSku; diff --git a/lib/services/networkManagement2/lib/lib/models/queryTroubleshootingParameters.js b/lib/services/networkManagement2/lib/lib/models/queryTroubleshootingParameters.js new file mode 100644 index 0000000000..ffca4c1894 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/queryTroubleshootingParameters.js @@ -0,0 +1,53 @@ +/* + * 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 that define the resource to query the troubleshooting result. + * + */ +class QueryTroubleshootingParameters { + /** + * Create a QueryTroubleshootingParameters. + * @member {string} targetResourceId The target resource ID to query the + * troubleshooting result. + */ + constructor() { + } + + /** + * Defines the metadata of QueryTroubleshootingParameters + * + * @returns {object} metadata of QueryTroubleshootingParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'QueryTroubleshootingParameters', + type: { + name: 'Composite', + className: 'QueryTroubleshootingParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = QueryTroubleshootingParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/resource.js b/lib/services/networkManagement2/lib/lib/models/resource.js new file mode 100644 index 0000000000..cbf0836276 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/resource.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'; + +const models = require('./index'); + +/** + * Common resource representation. + * + * @extends models['BaseResource'] + */ +class Resource extends models['BaseResource'] { + /** + * Create a Resource. + * @member {string} [id] Resource ID. + * @member {string} [name] Resource name. + * @member {string} [type] Resource type. + * @member {string} [location] Resource location. + * @member {object} [tags] Resource tags. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Resource + * + * @returns {object} metadata of Resource + * + */ + mapper() { + return { + required: false, + serializedName: 'Resource', + type: { + name: 'Composite', + className: 'Resource', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = Resource; diff --git a/lib/services/networkManagement2/lib/lib/models/resourceNavigationLink.js b/lib/services/networkManagement2/lib/lib/models/resourceNavigationLink.js new file mode 100644 index 0000000000..998fc4a73e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/resourceNavigationLink.js @@ -0,0 +1,101 @@ +/* + * 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'); + +/** + * ResourceNavigationLink resource. + * + * @extends models['SubResource'] + */ +class ResourceNavigationLink extends models['SubResource'] { + /** + * Create a ResourceNavigationLink. + * @member {string} [linkedResourceType] Resource type of the linked + * resource. + * @member {string} [link] Link to the external resource + * @member {string} [provisioningState] Provisioning state of the + * ResourceNavigationLink resource. + * @member {string} [name] Name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of ResourceNavigationLink + * + * @returns {object} metadata of ResourceNavigationLink + * + */ + mapper() { + return { + required: false, + serializedName: 'ResourceNavigationLink', + type: { + name: 'Composite', + className: 'ResourceNavigationLink', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + linkedResourceType: { + required: false, + serializedName: 'properties.linkedResourceType', + type: { + name: 'String' + } + }, + link: { + required: false, + serializedName: 'properties.link', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ResourceNavigationLink; diff --git a/lib/services/networkManagement2/lib/lib/models/retentionPolicyParameters.js b/lib/services/networkManagement2/lib/lib/models/retentionPolicyParameters.js new file mode 100644 index 0000000000..85a9101d3b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/retentionPolicyParameters.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'; + +/** + * Parameters that define the retention policy for flow log. + * + */ +class RetentionPolicyParameters { + /** + * Create a RetentionPolicyParameters. + * @member {number} [days] Number of days to retain flow log records. Default + * value: 0 . + * @member {boolean} [enabled] Flag to enable/disable retention. Default + * value: false . + */ + constructor() { + } + + /** + * Defines the metadata of RetentionPolicyParameters + * + * @returns {object} metadata of RetentionPolicyParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'RetentionPolicyParameters', + type: { + name: 'Composite', + className: 'RetentionPolicyParameters', + modelProperties: { + days: { + required: false, + serializedName: 'days', + defaultValue: 0, + type: { + name: 'Number' + } + }, + enabled: { + required: false, + serializedName: 'enabled', + defaultValue: false, + type: { + name: 'Boolean' + } + } + } + } + }; + } +} + +module.exports = RetentionPolicyParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/route.js b/lib/services/networkManagement2/lib/lib/models/route.js new file mode 100644 index 0000000000..8fb7c8b2b8 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/route.js @@ -0,0 +1,113 @@ +/* + * 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'); + +/** + * Route resource + * + * @extends models['SubResource'] + */ +class Route extends models['SubResource'] { + /** + * Create a Route. + * @member {string} [addressPrefix] The destination CIDR to which the route + * applies. + * @member {string} nextHopType The type of Azure hop the packet should be + * sent to. Possible values are: 'VirtualNetworkGateway', 'VnetLocal', + * 'Internet', 'VirtualAppliance', and 'None'. Possible values include: + * 'VirtualNetworkGateway', 'VnetLocal', 'Internet', 'VirtualAppliance', + * 'None' + * @member {string} [nextHopIpAddress] The IP address packets should be + * forwarded to. Next hop values are only allowed in routes where the next + * hop type is VirtualAppliance. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Route + * + * @returns {object} metadata of Route + * + */ + mapper() { + return { + required: false, + serializedName: 'Route', + type: { + name: 'Composite', + className: 'Route', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + addressPrefix: { + required: false, + serializedName: 'properties.addressPrefix', + type: { + name: 'String' + } + }, + nextHopType: { + required: true, + serializedName: 'properties.nextHopType', + type: { + name: 'String' + } + }, + nextHopIpAddress: { + required: false, + serializedName: 'properties.nextHopIpAddress', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Route; diff --git a/lib/services/networkManagement2/lib/lib/models/routeFilter.js b/lib/services/networkManagement2/lib/lib/models/routeFilter.js new file mode 100644 index 0000000000..3c965667ac --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeFilter.js @@ -0,0 +1,147 @@ +/* + * 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'); + +/** + * Route Filter Resource. + * + * @extends models['Resource'] + */ +class RouteFilter extends models['Resource'] { + /** + * Create a RouteFilter. + * @member {array} [rules] Collection of RouteFilterRules contained within a + * route filter. + * @member {array} [peerings] A collection of references to express route + * circuit peerings. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteFilter + * + * @returns {object} metadata of RouteFilter + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteFilter', + type: { + name: 'Composite', + className: 'RouteFilter', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + rules: { + required: false, + serializedName: 'properties.rules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteFilterRuleElementType', + type: { + name: 'Composite', + className: 'RouteFilterRule' + } + } + } + }, + peerings: { + required: false, + serializedName: 'properties.peerings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ExpressRouteCircuitPeeringElementType', + type: { + name: 'Composite', + className: 'ExpressRouteCircuitPeering' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteFilter; diff --git a/lib/services/networkManagement2/lib/lib/models/routeFilterListResult.js b/lib/services/networkManagement2/lib/lib/models/routeFilterListResult.js new file mode 100644 index 0000000000..07f60cfe43 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeFilterListResult.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'; + +/** + * Response for the ListRouteFilters API service call. + */ +class RouteFilterListResult extends Array { + /** + * Create a RouteFilterListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteFilterListResult + * + * @returns {object} metadata of RouteFilterListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteFilterListResult', + type: { + name: 'Composite', + className: 'RouteFilterListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteFilterElementType', + type: { + name: 'Composite', + className: 'RouteFilter' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteFilterListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/routeFilterRule.js b/lib/services/networkManagement2/lib/lib/models/routeFilterRule.js new file mode 100644 index 0000000000..026d2ba3cb --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeFilterRule.js @@ -0,0 +1,127 @@ +/* + * 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'); + +/** + * Route Filter Rule Resource + * + * @extends models['SubResource'] + */ +class RouteFilterRule extends models['SubResource'] { + /** + * Create a RouteFilterRule. + * @member {string} access The access type of the rule. Valid values are: + * 'Allow', 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {array} communities The collection for bgp community values to + * filter on. e.g. ['12076:5010','12076:5020'] + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', 'Succeeded' and + * 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [location] Resource location. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteFilterRule + * + * @returns {object} metadata of RouteFilterRule + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteFilterRule', + type: { + name: 'Composite', + className: 'RouteFilterRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + access: { + required: true, + serializedName: 'properties.access', + type: { + name: 'String' + } + }, + routeFilterRuleType: { + required: true, + isConstant: true, + serializedName: 'properties.routeFilterRuleType', + defaultValue: 'Community', + type: { + name: 'String' + } + }, + communities: { + required: true, + serializedName: 'properties.communities', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + etag: { + required: false, + readOnly: true, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteFilterRule; diff --git a/lib/services/networkManagement2/lib/lib/models/routeFilterRuleListResult.js b/lib/services/networkManagement2/lib/lib/models/routeFilterRuleListResult.js new file mode 100644 index 0000000000..d5fc3d232a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeFilterRuleListResult.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'; + +/** + * Response for the ListRouteFilterRules API service call + */ +class RouteFilterRuleListResult extends Array { + /** + * Create a RouteFilterRuleListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteFilterRuleListResult + * + * @returns {object} metadata of RouteFilterRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteFilterRuleListResult', + type: { + name: 'Composite', + className: 'RouteFilterRuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteFilterRuleElementType', + type: { + name: 'Composite', + className: 'RouteFilterRule' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteFilterRuleListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/routeListResult.js b/lib/services/networkManagement2/lib/lib/models/routeListResult.js new file mode 100644 index 0000000000..d5e97bccfd --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeListResult.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'; + +/** + * Response for the ListRoute API service call + */ +class RouteListResult extends Array { + /** + * Create a RouteListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteListResult + * + * @returns {object} metadata of RouteListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteListResult', + type: { + name: 'Composite', + className: 'RouteListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteElementType', + type: { + name: 'Composite', + className: 'Route' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/routeTable.js b/lib/services/networkManagement2/lib/lib/models/routeTable.js new file mode 100644 index 0000000000..e6355aad77 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeTable.js @@ -0,0 +1,153 @@ +/* + * 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'); + +/** + * Route table resource. + * + * @extends models['Resource'] + */ +class RouteTable extends models['Resource'] { + /** + * Create a RouteTable. + * @member {array} [routes] Collection of routes contained within a route + * table. + * @member {array} [subnets] A collection of references to subnets. + * @member {boolean} [disableBgpRoutePropagation] Gets or sets whether to + * disable the routes learned by BGP on that route table. True means disable. + * @member {string} [provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteTable + * + * @returns {object} metadata of RouteTable + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteTable', + type: { + name: 'Composite', + className: 'RouteTable', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + routes: { + required: false, + serializedName: 'properties.routes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteElementType', + type: { + name: 'Composite', + className: 'Route' + } + } + } + }, + subnets: { + required: false, + readOnly: true, + serializedName: 'properties.subnets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubnetElementType', + type: { + name: 'Composite', + className: 'Subnet' + } + } + } + }, + disableBgpRoutePropagation: { + required: false, + serializedName: 'properties.disableBgpRoutePropagation', + type: { + name: 'Boolean' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteTable; diff --git a/lib/services/networkManagement2/lib/lib/models/routeTableListResult.js b/lib/services/networkManagement2/lib/lib/models/routeTableListResult.js new file mode 100644 index 0000000000..e7fcdff6bc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/routeTableListResult.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'; + +/** + * Response for the ListRouteTable API service call. + */ +class RouteTableListResult extends Array { + /** + * Create a RouteTableListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of RouteTableListResult + * + * @returns {object} metadata of RouteTableListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'RouteTableListResult', + type: { + name: 'Composite', + className: 'RouteTableListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'RouteTableElementType', + type: { + name: 'Composite', + className: 'RouteTable' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = RouteTableListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/securityGroupNetworkInterface.js b/lib/services/networkManagement2/lib/lib/models/securityGroupNetworkInterface.js new file mode 100644 index 0000000000..fab0c7c38e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityGroupNetworkInterface.js @@ -0,0 +1,78 @@ +/* + * 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 interface and all its associated security rules. + * + */ +class SecurityGroupNetworkInterface { + /** + * Create a SecurityGroupNetworkInterface. + * @member {string} [id] ID of the network interface. + * @member {object} [securityRuleAssociations] + * @member {object} [securityRuleAssociations.networkInterfaceAssociation] + * @member {string} [securityRuleAssociations.networkInterfaceAssociation.id] + * Network interface ID. + * @member {array} + * [securityRuleAssociations.networkInterfaceAssociation.securityRules] + * Collection of custom security rules. + * @member {object} [securityRuleAssociations.subnetAssociation] + * @member {string} [securityRuleAssociations.subnetAssociation.id] Subnet + * ID. + * @member {array} [securityRuleAssociations.subnetAssociation.securityRules] + * Collection of custom security rules. + * @member {array} [securityRuleAssociations.defaultSecurityRules] Collection + * of default security rules of the network security group. + * @member {array} [securityRuleAssociations.effectiveSecurityRules] + * Collection of effective security rules. + */ + constructor() { + } + + /** + * Defines the metadata of SecurityGroupNetworkInterface + * + * @returns {object} metadata of SecurityGroupNetworkInterface + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityGroupNetworkInterface', + type: { + name: 'Composite', + className: 'SecurityGroupNetworkInterface', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + securityRuleAssociations: { + required: false, + serializedName: 'securityRuleAssociations', + type: { + name: 'Composite', + className: 'SecurityRuleAssociations' + } + } + } + } + }; + } +} + +module.exports = SecurityGroupNetworkInterface; diff --git a/lib/services/networkManagement2/lib/lib/models/securityGroupViewParameters.js b/lib/services/networkManagement2/lib/lib/models/securityGroupViewParameters.js new file mode 100644 index 0000000000..f44e5ddca7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityGroupViewParameters.js @@ -0,0 +1,52 @@ +/* + * 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 that define the VM to check security groups for. + * + */ +class SecurityGroupViewParameters { + /** + * Create a SecurityGroupViewParameters. + * @member {string} targetResourceId ID of the target VM. + */ + constructor() { + } + + /** + * Defines the metadata of SecurityGroupViewParameters + * + * @returns {object} metadata of SecurityGroupViewParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityGroupViewParameters', + type: { + name: 'Composite', + className: 'SecurityGroupViewParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecurityGroupViewParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/securityGroupViewResult.js b/lib/services/networkManagement2/lib/lib/models/securityGroupViewResult.js new file mode 100644 index 0000000000..4e15fddac6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityGroupViewResult.js @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const models = require('./index'); + +/** + * The information about security rules applied to the specified VM. + * + */ +class SecurityGroupViewResult { + /** + * Create a SecurityGroupViewResult. + * @member {array} [networkInterfaces] List of network interfaces on the + * specified VM. + */ + constructor() { + } + + /** + * Defines the metadata of SecurityGroupViewResult + * + * @returns {object} metadata of SecurityGroupViewResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityGroupViewResult', + type: { + name: 'Composite', + className: 'SecurityGroupViewResult', + modelProperties: { + networkInterfaces: { + required: false, + serializedName: 'networkInterfaces', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityGroupNetworkInterfaceElementType', + type: { + name: 'Composite', + className: 'SecurityGroupNetworkInterface' + } + } + } + } + } + } + }; + } +} + +module.exports = SecurityGroupViewResult; diff --git a/lib/services/networkManagement2/lib/lib/models/securityRule.js b/lib/services/networkManagement2/lib/lib/models/securityRule.js new file mode 100644 index 0000000000..2cd405eb52 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityRule.js @@ -0,0 +1,269 @@ +/* + * 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 security rule. + * + * @extends models['SubResource'] + */ +class SecurityRule extends models['SubResource'] { + /** + * Create a SecurityRule. + * @member {string} [description] A description for this rule. Restricted to + * 140 chars. + * @member {string} protocol Network protocol this rule applies to. Possible + * values are 'Tcp', 'Udp', and '*'. Possible values include: 'Tcp', 'Udp', + * '*' + * @member {string} [sourcePortRange] The source port or range. Integer or + * range between 0 and 65535. Asterix '*' can also be used to match all + * ports. + * @member {string} [destinationPortRange] The destination port or range. + * Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * @member {string} [sourceAddressPrefix] The CIDR or source IP range. + * Asterix '*' can also be used to match all source IPs. Default tags such as + * 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If + * this is an ingress rule, specifies where network traffic originates from. + * @member {array} [sourceAddressPrefixes] The CIDR or source IP ranges. + * @member {array} [sourceApplicationSecurityGroups] The application security + * group specified as source. + * @member {string} [destinationAddressPrefix] The destination address + * prefix. CIDR or destination IP range. Asterix '*' can also be used to + * match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * @member {array} [destinationAddressPrefixes] The destination address + * prefixes. CIDR or destination IP ranges. + * @member {array} [destinationApplicationSecurityGroups] The application + * security group specified as destination. + * @member {array} [sourcePortRanges] The source port ranges. + * @member {array} [destinationPortRanges] The destination port ranges. + * @member {string} access The network traffic is allowed or denied. Possible + * values are: 'Allow' and 'Deny'. Possible values include: 'Allow', 'Deny' + * @member {number} [priority] The priority of the rule. The value can be + * between 100 and 4096. The priority number must be unique for each rule in + * the collection. The lower the priority number, the higher the priority of + * the rule. + * @member {string} direction The direction of the rule. The direction + * specifies if rule will be evaluated on incoming or outcoming traffic. + * Possible values are: 'Inbound' and 'Outbound'. Possible values include: + * 'Inbound', 'Outbound' + * @member {string} [provisioningState] The provisioning state of the public + * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SecurityRule + * + * @returns {object} metadata of SecurityRule + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityRule', + type: { + name: 'Composite', + className: 'SecurityRule', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + description: { + required: false, + serializedName: 'properties.description', + type: { + name: 'String' + } + }, + protocol: { + required: true, + serializedName: 'properties.protocol', + type: { + name: 'String' + } + }, + sourcePortRange: { + required: false, + serializedName: 'properties.sourcePortRange', + type: { + name: 'String' + } + }, + destinationPortRange: { + required: false, + serializedName: 'properties.destinationPortRange', + type: { + name: 'String' + } + }, + sourceAddressPrefix: { + required: false, + serializedName: 'properties.sourceAddressPrefix', + type: { + name: 'String' + } + }, + sourceAddressPrefixes: { + required: false, + serializedName: 'properties.sourceAddressPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + sourceApplicationSecurityGroups: { + required: false, + serializedName: 'properties.sourceApplicationSecurityGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationSecurityGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroup' + } + } + } + }, + destinationAddressPrefix: { + required: false, + serializedName: 'properties.destinationAddressPrefix', + type: { + name: 'String' + } + }, + destinationAddressPrefixes: { + required: false, + serializedName: 'properties.destinationAddressPrefixes', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + destinationApplicationSecurityGroups: { + required: false, + serializedName: 'properties.destinationApplicationSecurityGroups', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ApplicationSecurityGroupElementType', + type: { + name: 'Composite', + className: 'ApplicationSecurityGroup' + } + } + } + }, + sourcePortRanges: { + required: false, + serializedName: 'properties.sourcePortRanges', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + destinationPortRanges: { + required: false, + serializedName: 'properties.destinationPortRanges', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + access: { + required: true, + serializedName: 'properties.access', + type: { + name: 'String' + } + }, + priority: { + required: false, + serializedName: 'properties.priority', + type: { + name: 'Number' + } + }, + direction: { + required: true, + serializedName: 'properties.direction', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecurityRule; diff --git a/lib/services/networkManagement2/lib/lib/models/securityRuleAssociations.js b/lib/services/networkManagement2/lib/lib/models/securityRuleAssociations.js new file mode 100644 index 0000000000..bfb3321308 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityRuleAssociations.js @@ -0,0 +1,104 @@ +/* + * 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'); + +/** + * All security rules associated with the network interface. + * + */ +class SecurityRuleAssociations { + /** + * Create a SecurityRuleAssociations. + * @member {object} [networkInterfaceAssociation] + * @member {string} [networkInterfaceAssociation.id] Network interface ID. + * @member {array} [networkInterfaceAssociation.securityRules] Collection of + * custom security rules. + * @member {object} [subnetAssociation] + * @member {string} [subnetAssociation.id] Subnet ID. + * @member {array} [subnetAssociation.securityRules] Collection of custom + * security rules. + * @member {array} [defaultSecurityRules] Collection of default security + * rules of the network security group. + * @member {array} [effectiveSecurityRules] Collection of effective security + * rules. + */ + constructor() { + } + + /** + * Defines the metadata of SecurityRuleAssociations + * + * @returns {object} metadata of SecurityRuleAssociations + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityRuleAssociations', + type: { + name: 'Composite', + className: 'SecurityRuleAssociations', + modelProperties: { + networkInterfaceAssociation: { + required: false, + serializedName: 'networkInterfaceAssociation', + type: { + name: 'Composite', + className: 'NetworkInterfaceAssociation' + } + }, + subnetAssociation: { + required: false, + serializedName: 'subnetAssociation', + type: { + name: 'Composite', + className: 'SubnetAssociation' + } + }, + defaultSecurityRules: { + required: false, + serializedName: 'defaultSecurityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + }, + effectiveSecurityRules: { + required: false, + serializedName: 'effectiveSecurityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'EffectiveNetworkSecurityRuleElementType', + type: { + name: 'Composite', + className: 'EffectiveNetworkSecurityRule' + } + } + } + } + } + } + }; + } +} + +module.exports = SecurityRuleAssociations; diff --git a/lib/services/networkManagement2/lib/lib/models/securityRuleListResult.js b/lib/services/networkManagement2/lib/lib/models/securityRuleListResult.js new file mode 100644 index 0000000000..f8e55a66b4 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/securityRuleListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListSecurityRule API service call. Retrieves all security rules + * that belongs to a network security group. + */ +class SecurityRuleListResult extends Array { + /** + * Create a SecurityRuleListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SecurityRuleListResult + * + * @returns {object} metadata of SecurityRuleListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SecurityRuleListResult', + type: { + name: 'Composite', + className: 'SecurityRuleListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SecurityRuleListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/serviceEndpointPropertiesFormat.js b/lib/services/networkManagement2/lib/lib/models/serviceEndpointPropertiesFormat.js new file mode 100644 index 0000000000..710f651b4e --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/serviceEndpointPropertiesFormat.js @@ -0,0 +1,76 @@ +/* + * 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'; + +/** + * The service endpoint properties. + * + */ +class ServiceEndpointPropertiesFormat { + /** + * Create a ServiceEndpointPropertiesFormat. + * @member {string} [service] The type of the endpoint service. + * @member {array} [locations] A list of locations. + * @member {string} [provisioningState] The provisioning state of the + * resource. + */ + constructor() { + } + + /** + * Defines the metadata of ServiceEndpointPropertiesFormat + * + * @returns {object} metadata of ServiceEndpointPropertiesFormat + * + */ + mapper() { + return { + required: false, + serializedName: 'ServiceEndpointPropertiesFormat', + type: { + name: 'Composite', + className: 'ServiceEndpointPropertiesFormat', + modelProperties: { + service: { + required: false, + serializedName: 'service', + type: { + name: 'String' + } + }, + locations: { + required: false, + serializedName: 'locations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'provisioningState', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = ServiceEndpointPropertiesFormat; diff --git a/lib/services/networkManagement2/lib/lib/models/subResource.js b/lib/services/networkManagement2/lib/lib/models/subResource.js new file mode 100644 index 0000000000..51215f1707 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/subResource.js @@ -0,0 +1,56 @@ +/* + * 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'); + +/** + * Reference to another subresource. + * + * @extends models['BaseResource'] + */ +class SubResource extends models['BaseResource'] { + /** + * Create a SubResource. + * @member {string} [id] Resource ID. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubResource + * + * @returns {object} metadata of SubResource + * + */ + mapper() { + return { + required: false, + serializedName: 'SubResource', + type: { + name: 'Composite', + className: 'SubResource', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubResource; diff --git a/lib/services/networkManagement2/lib/lib/models/subnet.js b/lib/services/networkManagement2/lib/lib/models/subnet.js new file mode 100644 index 0000000000..8ba2e0f670 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/subnet.js @@ -0,0 +1,186 @@ +/* + * 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'); + +/** + * Subnet in a virtual network resource. + * + * @extends models['SubResource'] + */ +class Subnet extends models['SubResource'] { + /** + * Create a Subnet. + * @member {string} [addressPrefix] The address prefix for the subnet. + * @member {object} [networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * @member {array} [networkSecurityGroup.securityRules] A collection of + * security rules of the network security group. + * @member {array} [networkSecurityGroup.defaultSecurityRules] The default + * security rules of network security group. + * @member {array} [networkSecurityGroup.networkInterfaces] A collection of + * references to network interfaces. + * @member {array} [networkSecurityGroup.subnets] A collection of references + * to subnets. + * @member {string} [networkSecurityGroup.resourceGuid] The resource GUID + * property of the network security group resource. + * @member {string} [networkSecurityGroup.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [networkSecurityGroup.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {object} [routeTable] The reference of the RouteTable resource. + * @member {array} [routeTable.routes] Collection of routes contained within + * a route table. + * @member {array} [routeTable.subnets] A collection of references to + * subnets. + * @member {boolean} [routeTable.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True + * means disable. + * @member {string} [routeTable.provisioningState] The provisioning state of + * the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [routeTable.etag] Gets a unique read-only string that + * changes whenever the resource is updated. + * @member {array} [serviceEndpoints] An array of service endpoints. + * @member {array} [ipConfigurations] Gets an array of references to the + * network interface IP configurations using subnet. + * @member {array} [resourceNavigationLinks] Gets an array of references to + * the external resources using subnet. + * @member {string} [provisioningState] The provisioning state of the + * resource. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of Subnet + * + * @returns {object} metadata of Subnet + * + */ + mapper() { + return { + required: false, + serializedName: 'Subnet', + type: { + name: 'Composite', + className: 'Subnet', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + addressPrefix: { + required: false, + serializedName: 'properties.addressPrefix', + type: { + name: 'String' + } + }, + networkSecurityGroup: { + required: false, + serializedName: 'properties.networkSecurityGroup', + type: { + name: 'Composite', + className: 'NetworkSecurityGroup' + } + }, + routeTable: { + required: false, + serializedName: 'properties.routeTable', + type: { + name: 'Composite', + className: 'RouteTable' + } + }, + serviceEndpoints: { + required: false, + serializedName: 'properties.serviceEndpoints', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ServiceEndpointPropertiesFormatElementType', + type: { + name: 'Composite', + className: 'ServiceEndpointPropertiesFormat' + } + } + } + }, + ipConfigurations: { + required: false, + readOnly: true, + serializedName: 'properties.ipConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IPConfigurationElementType', + type: { + name: 'Composite', + className: 'IPConfiguration' + } + } + } + }, + resourceNavigationLinks: { + required: false, + serializedName: 'properties.resourceNavigationLinks', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'ResourceNavigationLinkElementType', + type: { + name: 'Composite', + className: 'ResourceNavigationLink' + } + } + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = Subnet; diff --git a/lib/services/networkManagement2/lib/lib/models/subnetAssociation.js b/lib/services/networkManagement2/lib/lib/models/subnetAssociation.js new file mode 100644 index 0000000000..eadfdd90d5 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/subnetAssociation.js @@ -0,0 +1,71 @@ +/* + * 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 interface and its custom security rules. + * + */ +class SubnetAssociation { + /** + * Create a SubnetAssociation. + * @member {string} [id] Subnet ID. + * @member {array} [securityRules] Collection of custom security rules. + */ + constructor() { + } + + /** + * Defines the metadata of SubnetAssociation + * + * @returns {object} metadata of SubnetAssociation + * + */ + mapper() { + return { + required: false, + serializedName: 'SubnetAssociation', + type: { + name: 'Composite', + className: 'SubnetAssociation', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + securityRules: { + required: false, + serializedName: 'securityRules', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SecurityRuleElementType', + type: { + name: 'Composite', + className: 'SecurityRule' + } + } + } + } + } + } + }; + } +} + +module.exports = SubnetAssociation; diff --git a/lib/services/networkManagement2/lib/lib/models/subnetListResult.js b/lib/services/networkManagement2/lib/lib/models/subnetListResult.js new file mode 100644 index 0000000000..fd7e58bb19 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/subnetListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListSubnets API service callRetrieves all subnet that belongs + * to a virtual network + */ +class SubnetListResult extends Array { + /** + * Create a SubnetListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of SubnetListResult + * + * @returns {object} metadata of SubnetListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'SubnetListResult', + type: { + name: 'Composite', + className: 'SubnetListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubnetElementType', + type: { + name: 'Composite', + className: 'Subnet' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = SubnetListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/tagsObject.js b/lib/services/networkManagement2/lib/lib/models/tagsObject.js new file mode 100644 index 0000000000..755b116391 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/tagsObject.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'; + +/** + * Tags object for patch operations. + * + */ +class TagsObject { + /** + * Create a TagsObject. + * @member {object} [tags] Resource tags. + */ + constructor() { + } + + /** + * Defines the metadata of TagsObject + * + * @returns {object} metadata of TagsObject + * + */ + mapper() { + return { + required: false, + serializedName: 'TagsObject', + type: { + name: 'Composite', + className: 'TagsObject', + modelProperties: { + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = TagsObject; diff --git a/lib/services/networkManagement2/lib/lib/models/topology.js b/lib/services/networkManagement2/lib/lib/models/topology.js new file mode 100644 index 0000000000..3aea099c87 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/topology.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'; + +const models = require('./index'); + +/** + * Topology of the specified resource group. + * + */ +class Topology { + /** + * Create a Topology. + * @member {string} [id] GUID representing the operation id. + * @member {date} [createdDateTime] The datetime when the topology was + * initially created for the resource group. + * @member {date} [lastModified] The datetime when the topology was last + * modified. + * @member {array} [resources] + */ + constructor() { + } + + /** + * Defines the metadata of Topology + * + * @returns {object} metadata of Topology + * + */ + mapper() { + return { + required: false, + serializedName: 'Topology', + type: { + name: 'Composite', + className: 'Topology', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + createdDateTime: { + required: false, + readOnly: true, + serializedName: 'createdDateTime', + type: { + name: 'DateTime' + } + }, + lastModified: { + required: false, + readOnly: true, + serializedName: 'lastModified', + type: { + name: 'DateTime' + } + }, + resources: { + required: false, + serializedName: 'resources', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TopologyResourceElementType', + type: { + name: 'Composite', + className: 'TopologyResource' + } + } + } + } + } + } + }; + } +} + +module.exports = Topology; diff --git a/lib/services/networkManagement2/lib/lib/models/topologyAssociation.js b/lib/services/networkManagement2/lib/lib/models/topologyAssociation.js new file mode 100644 index 0000000000..af3667e2ec --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/topologyAssociation.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Resources that have an association with the parent resource. + * + */ +class TopologyAssociation { + /** + * Create a TopologyAssociation. + * @member {string} [name] The name of the resource that is associated with + * the parent resource. + * @member {string} [resourceId] The ID of the resource that is associated + * with the parent resource. + * @member {string} [associationType] The association type of the child + * resource to the parent resource. Possible values include: 'Associated', + * 'Contains' + */ + constructor() { + } + + /** + * Defines the metadata of TopologyAssociation + * + * @returns {object} metadata of TopologyAssociation + * + */ + mapper() { + return { + required: false, + serializedName: 'TopologyAssociation', + type: { + name: 'Composite', + className: 'TopologyAssociation', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + resourceId: { + required: false, + serializedName: 'resourceId', + type: { + name: 'String' + } + }, + associationType: { + required: false, + serializedName: 'associationType', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TopologyAssociation; diff --git a/lib/services/networkManagement2/lib/lib/models/topologyParameters.js b/lib/services/networkManagement2/lib/lib/models/topologyParameters.js new file mode 100644 index 0000000000..3d123836f6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/topologyParameters.js @@ -0,0 +1,76 @@ +/* + * 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 that define the representation of topology. + * + */ +class TopologyParameters { + /** + * Create a TopologyParameters. + * @member {string} [targetResourceGroupName] The name of the target resource + * group to perform topology on. + * @member {object} [targetVirtualNetwork] The reference of the Virtual + * Network resource. + * @member {string} [targetVirtualNetwork.id] Resource ID. + * @member {object} [targetSubnet] The reference of the Subnet resource. + * @member {string} [targetSubnet.id] Resource ID. + */ + constructor() { + } + + /** + * Defines the metadata of TopologyParameters + * + * @returns {object} metadata of TopologyParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'TopologyParameters', + type: { + name: 'Composite', + className: 'TopologyParameters', + modelProperties: { + targetResourceGroupName: { + required: false, + serializedName: 'targetResourceGroupName', + type: { + name: 'String' + } + }, + targetVirtualNetwork: { + required: false, + serializedName: 'targetVirtualNetwork', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + targetSubnet: { + required: false, + serializedName: 'targetSubnet', + type: { + name: 'Composite', + className: 'SubResource' + } + } + } + } + }; + } +} + +module.exports = TopologyParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/topologyResource.js b/lib/services/networkManagement2/lib/lib/models/topologyResource.js new file mode 100644 index 0000000000..3d3475924c --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/topologyResource.js @@ -0,0 +1,87 @@ +/* + * 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 network resource topology information for the given resource group. + * + */ +class TopologyResource { + /** + * Create a TopologyResource. + * @member {string} [name] Name of the resource. + * @member {string} [id] ID of the resource. + * @member {string} [location] Resource location. + * @member {array} [associations] Holds the associations the resource has + * with other resources in the resource group. + */ + constructor() { + } + + /** + * Defines the metadata of TopologyResource + * + * @returns {object} metadata of TopologyResource + * + */ + mapper() { + return { + required: false, + serializedName: 'TopologyResource', + type: { + name: 'Composite', + className: 'TopologyResource', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + associations: { + required: false, + serializedName: 'associations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TopologyAssociationElementType', + type: { + name: 'Composite', + className: 'TopologyAssociation' + } + } + } + } + } + } + }; + } +} + +module.exports = TopologyResource; diff --git a/lib/services/networkManagement2/lib/lib/models/troubleshootingDetails.js b/lib/services/networkManagement2/lib/lib/models/troubleshootingDetails.js new file mode 100644 index 0000000000..a05817b8c9 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/troubleshootingDetails.js @@ -0,0 +1,94 @@ +/* + * 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'); + +/** + * Information gained from troubleshooting of specified resource. + * + */ +class TroubleshootingDetails { + /** + * Create a TroubleshootingDetails. + * @member {string} [id] The id of the get troubleshoot operation. + * @member {string} [reasonType] Reason type of failure. + * @member {string} [summary] A summary of troubleshooting. + * @member {string} [detail] Details on troubleshooting results. + * @member {array} [recommendedActions] List of recommended actions. + */ + constructor() { + } + + /** + * Defines the metadata of TroubleshootingDetails + * + * @returns {object} metadata of TroubleshootingDetails + * + */ + mapper() { + return { + required: false, + serializedName: 'TroubleshootingDetails', + type: { + name: 'Composite', + className: 'TroubleshootingDetails', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + reasonType: { + required: false, + serializedName: 'reasonType', + type: { + name: 'String' + } + }, + summary: { + required: false, + serializedName: 'summary', + type: { + name: 'String' + } + }, + detail: { + required: false, + serializedName: 'detail', + type: { + name: 'String' + } + }, + recommendedActions: { + required: false, + serializedName: 'recommendedActions', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TroubleshootingRecommendedActionsElementType', + type: { + name: 'Composite', + className: 'TroubleshootingRecommendedActions' + } + } + } + } + } + } + }; + } +} + +module.exports = TroubleshootingDetails; diff --git a/lib/services/networkManagement2/lib/lib/models/troubleshootingParameters.js b/lib/services/networkManagement2/lib/lib/models/troubleshootingParameters.js new file mode 100644 index 0000000000..d57f7fcc88 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/troubleshootingParameters.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'; + +/** + * Parameters that define the resource to troubleshoot. + * + */ +class TroubleshootingParameters { + /** + * Create a TroubleshootingParameters. + * @member {string} targetResourceId The target resource to troubleshoot. + * @member {string} storageId The ID for the storage account to save the + * troubleshoot result. + * @member {string} storagePath The path to the blob to save the troubleshoot + * result in. + */ + constructor() { + } + + /** + * Defines the metadata of TroubleshootingParameters + * + * @returns {object} metadata of TroubleshootingParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'TroubleshootingParameters', + type: { + name: 'Composite', + className: 'TroubleshootingParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + }, + storageId: { + required: true, + serializedName: 'properties.storageId', + type: { + name: 'String' + } + }, + storagePath: { + required: true, + serializedName: 'properties.storagePath', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TroubleshootingParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/troubleshootingRecommendedActions.js b/lib/services/networkManagement2/lib/lib/models/troubleshootingRecommendedActions.js new file mode 100644 index 0000000000..60b1587277 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/troubleshootingRecommendedActions.js @@ -0,0 +1,78 @@ +/* + * 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'; + +/** + * Recommended actions based on discovered issues. + * + */ +class TroubleshootingRecommendedActions { + /** + * Create a TroubleshootingRecommendedActions. + * @member {string} [actionId] ID of the recommended action. + * @member {string} [actionText] Description of recommended actions. + * @member {string} [actionUri] The uri linking to a documentation for the + * recommended troubleshooting actions. + * @member {string} [actionUriText] The information from the URI for the + * recommended troubleshooting actions. + */ + constructor() { + } + + /** + * Defines the metadata of TroubleshootingRecommendedActions + * + * @returns {object} metadata of TroubleshootingRecommendedActions + * + */ + mapper() { + return { + required: false, + serializedName: 'TroubleshootingRecommendedActions', + type: { + name: 'Composite', + className: 'TroubleshootingRecommendedActions', + modelProperties: { + actionId: { + required: false, + serializedName: 'actionId', + type: { + name: 'String' + } + }, + actionText: { + required: false, + serializedName: 'actionText', + type: { + name: 'String' + } + }, + actionUri: { + required: false, + serializedName: 'actionUri', + type: { + name: 'String' + } + }, + actionUriText: { + required: false, + serializedName: 'actionUriText', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TroubleshootingRecommendedActions; diff --git a/lib/services/networkManagement2/lib/lib/models/troubleshootingResult.js b/lib/services/networkManagement2/lib/lib/models/troubleshootingResult.js new file mode 100644 index 0000000000..567714ac73 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/troubleshootingResult.js @@ -0,0 +1,86 @@ +/* + * 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'); + +/** + * Troubleshooting information gained from specified resource. + * + */ +class TroubleshootingResult { + /** + * Create a TroubleshootingResult. + * @member {date} [startTime] The start time of the troubleshooting. + * @member {date} [endTime] The end time of the troubleshooting. + * @member {string} [code] The result code of the troubleshooting. + * @member {array} [results] Information from troubleshooting. + */ + constructor() { + } + + /** + * Defines the metadata of TroubleshootingResult + * + * @returns {object} metadata of TroubleshootingResult + * + */ + mapper() { + return { + required: false, + serializedName: 'TroubleshootingResult', + type: { + name: 'Composite', + className: 'TroubleshootingResult', + modelProperties: { + startTime: { + required: false, + serializedName: 'startTime', + type: { + name: 'DateTime' + } + }, + endTime: { + required: false, + serializedName: 'endTime', + type: { + name: 'DateTime' + } + }, + code: { + required: false, + serializedName: 'code', + type: { + name: 'String' + } + }, + results: { + required: false, + serializedName: 'results', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TroubleshootingDetailsElementType', + type: { + name: 'Composite', + className: 'TroubleshootingDetails' + } + } + } + } + } + } + }; + } +} + +module.exports = TroubleshootingResult; diff --git a/lib/services/networkManagement2/lib/lib/models/tunnelConnectionHealth.js b/lib/services/networkManagement2/lib/lib/models/tunnelConnectionHealth.js new file mode 100644 index 0000000000..4f0858957a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/tunnelConnectionHealth.js @@ -0,0 +1,94 @@ +/* + * 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'; + +/** + * VirtualNetworkGatewayConnection properties + * + */ +class TunnelConnectionHealth { + /** + * Create a TunnelConnectionHealth. + * @member {string} [tunnel] Tunnel name. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values include: 'Unknown', 'Connecting', 'Connected', + * 'NotConnected' + * @member {number} [ingressBytesTransferred] The Ingress Bytes Transferred + * in this connection + * @member {number} [egressBytesTransferred] The Egress Bytes Transferred in + * this connection + * @member {string} [lastConnectionEstablishedUtcTime] The time at which + * connection was established in Utc format. + */ + constructor() { + } + + /** + * Defines the metadata of TunnelConnectionHealth + * + * @returns {object} metadata of TunnelConnectionHealth + * + */ + mapper() { + return { + required: false, + serializedName: 'TunnelConnectionHealth', + type: { + name: 'Composite', + className: 'TunnelConnectionHealth', + modelProperties: { + tunnel: { + required: false, + readOnly: true, + serializedName: 'tunnel', + type: { + name: 'String' + } + }, + connectionStatus: { + required: false, + readOnly: true, + serializedName: 'connectionStatus', + type: { + name: 'String' + } + }, + ingressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'ingressBytesTransferred', + type: { + name: 'Number' + } + }, + egressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'egressBytesTransferred', + type: { + name: 'Number' + } + }, + lastConnectionEstablishedUtcTime: { + required: false, + readOnly: true, + serializedName: 'lastConnectionEstablishedUtcTime', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = TunnelConnectionHealth; diff --git a/lib/services/networkManagement2/lib/lib/models/usage.js b/lib/services/networkManagement2/lib/lib/models/usage.js new file mode 100644 index 0000000000..c232774e31 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/usage.js @@ -0,0 +1,92 @@ +/* + * 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'); + +/** + * Describes network resource usage. + * + */ +class Usage { + /** + * Create a Usage. + * @member {string} [id] Resource identifier. + * @member {number} currentValue The current value of the usage. + * @member {number} limit The limit of usage. + * @member {object} name The name of the type of usage. + * @member {string} [name.value] A string describing the resource name. + * @member {string} [name.localizedValue] A localized string describing the + * resource name. + */ + constructor() { + } + + /** + * Defines the metadata of Usage + * + * @returns {object} metadata of Usage + * + */ + mapper() { + return { + required: false, + serializedName: 'Usage', + type: { + name: 'Composite', + className: 'Usage', + modelProperties: { + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + unit: { + required: true, + isConstant: true, + serializedName: 'unit', + defaultValue: 'Count', + type: { + name: 'String' + } + }, + currentValue: { + required: true, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + limit: { + required: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + name: { + required: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'UsageName' + } + } + } + } + }; + } +} + +module.exports = Usage; diff --git a/lib/services/networkManagement2/lib/lib/models/usageName.js b/lib/services/networkManagement2/lib/lib/models/usageName.js new file mode 100644 index 0000000000..391cb23fe0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/usageName.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'; + +/** + * The usage names. + * + */ +class UsageName { + /** + * Create a UsageName. + * @member {string} [value] A string describing the resource name. + * @member {string} [localizedValue] A localized string describing the + * resource name. + */ + constructor() { + } + + /** + * Defines the metadata of UsageName + * + * @returns {object} metadata of UsageName + * + */ + mapper() { + return { + required: false, + serializedName: 'UsageName', + type: { + name: 'Composite', + className: 'UsageName', + modelProperties: { + value: { + required: false, + serializedName: 'value', + type: { + name: 'String' + } + }, + localizedValue: { + required: false, + serializedName: 'localizedValue', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UsageName; diff --git a/lib/services/networkManagement2/lib/lib/models/usagesListResult.js b/lib/services/networkManagement2/lib/lib/models/usagesListResult.js new file mode 100644 index 0000000000..7c5697ddb4 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/usagesListResult.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'; + +/** + * The list usages operation response. + */ +class UsagesListResult extends Array { + /** + * Create a UsagesListResult. + * @member {string} [nextLink] URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of UsagesListResult + * + * @returns {object} metadata of UsagesListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'UsagesListResult', + type: { + name: 'Composite', + className: 'UsagesListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'UsageElementType', + type: { + name: 'Composite', + className: 'Usage' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = UsagesListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/verificationIPFlowParameters.js b/lib/services/networkManagement2/lib/lib/models/verificationIPFlowParameters.js new file mode 100644 index 0000000000..6270bd0162 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/verificationIPFlowParameters.js @@ -0,0 +1,119 @@ +/* + * 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 that define the IP flow to be verified. + * + */ +class VerificationIPFlowParameters { + /** + * Create a VerificationIPFlowParameters. + * @member {string} targetResourceId The ID of the target resource to perform + * next-hop on. + * @member {string} direction The direction of the packet represented as a + * 5-tuple. Possible values include: 'Inbound', 'Outbound' + * @member {string} protocol Protocol to be verified on. Possible values + * include: 'TCP', 'UDP' + * @member {string} localPort The local port. Acceptable values are a single + * integer in the range (0-65535). Support for * for the source port, which + * depends on the direction. + * @member {string} remotePort The remote port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * @member {string} localIPAddress The local IP address. Acceptable values + * are valid IPv4 addresses. + * @member {string} remoteIPAddress The remote IP address. Acceptable values + * are valid IPv4 addresses. + * @member {string} [targetNicResourceId] The NIC ID. (If VM has multiple + * NICs and IP forwarding is enabled on any of them, then this parameter must + * be specified. Otherwise optional). + */ + constructor() { + } + + /** + * Defines the metadata of VerificationIPFlowParameters + * + * @returns {object} metadata of VerificationIPFlowParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VerificationIPFlowParameters', + type: { + name: 'Composite', + className: 'VerificationIPFlowParameters', + modelProperties: { + targetResourceId: { + required: true, + serializedName: 'targetResourceId', + type: { + name: 'String' + } + }, + direction: { + required: true, + serializedName: 'direction', + type: { + name: 'String' + } + }, + protocol: { + required: true, + serializedName: 'protocol', + type: { + name: 'String' + } + }, + localPort: { + required: true, + serializedName: 'localPort', + type: { + name: 'String' + } + }, + remotePort: { + required: true, + serializedName: 'remotePort', + type: { + name: 'String' + } + }, + localIPAddress: { + required: true, + serializedName: 'localIPAddress', + type: { + name: 'String' + } + }, + remoteIPAddress: { + required: true, + serializedName: 'remoteIPAddress', + type: { + name: 'String' + } + }, + targetNicResourceId: { + required: false, + serializedName: 'targetNicResourceId', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VerificationIPFlowParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/verificationIPFlowResult.js b/lib/services/networkManagement2/lib/lib/models/verificationIPFlowResult.js new file mode 100644 index 0000000000..47b6fa77d7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/verificationIPFlowResult.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Results of IP flow verification on the target resource. + * + */ +class VerificationIPFlowResult { + /** + * Create a VerificationIPFlowResult. + * @member {string} [access] Indicates whether the traffic is allowed or + * denied. Possible values include: 'Allow', 'Deny' + * @member {string} [ruleName] Name of the rule. If input is not matched + * against any security rule, it is not displayed. + */ + constructor() { + } + + /** + * Defines the metadata of VerificationIPFlowResult + * + * @returns {object} metadata of VerificationIPFlowResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VerificationIPFlowResult', + type: { + name: 'Composite', + className: 'VerificationIPFlowResult', + modelProperties: { + access: { + required: false, + serializedName: 'access', + type: { + name: 'String' + } + }, + ruleName: { + required: false, + serializedName: 'ruleName', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VerificationIPFlowResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetwork.js b/lib/services/networkManagement2/lib/lib/models/virtualNetwork.js new file mode 100644 index 0000000000..824d27e2a4 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetwork.js @@ -0,0 +1,210 @@ +/* + * 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'); + +/** + * Virtual Network resource. + * + * @extends models['Resource'] + */ +class VirtualNetwork extends models['Resource'] { + /** + * Create a VirtualNetwork. + * @member {object} [addressSpace] The AddressSpace that contains an array of + * IP address ranges that can be used by subnets. + * @member {array} [addressSpace.addressPrefixes] A list of address blocks + * reserved for this virtual network in CIDR notation. + * @member {object} [dhcpOptions] The dhcpOptions that contains an array of + * DNS servers available to VMs deployed in the virtual network. + * @member {array} [dhcpOptions.dnsServers] The list of DNS servers IP + * addresses. + * @member {array} [subnets] A list of subnets in a Virtual Network. + * @member {array} [virtualNetworkPeerings] A list of peerings in a Virtual + * Network. + * @member {string} [resourceGuid] The resourceGuid property of the Virtual + * Network resource. + * @member {string} [provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * @member {boolean} [enableDdosProtection] Indicates if DDoS protection is + * enabled for all the protected resources in the virtual network. It + * requires a DDoS protection plan associated with the resource. Default + * value: false . + * @member {boolean} [enableVmProtection] Indicates if VM protection is + * enabled for all the subnets in the virtual network. Default value: false . + * @member {object} [ddosProtectionPlan] The DDoS protection plan associated + * with the virtual network. + * @member {string} [ddosProtectionPlan.id] Resource ID. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetwork + * + * @returns {object} metadata of VirtualNetwork + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetwork', + type: { + name: 'Composite', + className: 'VirtualNetwork', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + addressSpace: { + required: false, + serializedName: 'properties.addressSpace', + type: { + name: 'Composite', + className: 'AddressSpace' + } + }, + dhcpOptions: { + required: false, + serializedName: 'properties.dhcpOptions', + type: { + name: 'Composite', + className: 'DhcpOptions' + } + }, + subnets: { + required: false, + serializedName: 'properties.subnets', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'SubnetElementType', + type: { + name: 'Composite', + className: 'Subnet' + } + } + } + }, + virtualNetworkPeerings: { + required: false, + serializedName: 'properties.virtualNetworkPeerings', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkPeeringElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkPeering' + } + } + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + enableDdosProtection: { + required: false, + serializedName: 'properties.enableDdosProtection', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + enableVmProtection: { + required: false, + serializedName: 'properties.enableVmProtection', + defaultValue: false, + type: { + name: 'Boolean' + } + }, + ddosProtectionPlan: { + required: false, + serializedName: 'properties.ddosProtectionPlan', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetwork; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkConnectionGatewayReference.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkConnectionGatewayReference.js new file mode 100644 index 0000000000..8484f69350 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkConnectionGatewayReference.js @@ -0,0 +1,53 @@ +/* + * 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'; + +/** + * A reference to VirtualNetworkGateway or LocalNetworkGateway resource. + * + */ +class VirtualNetworkConnectionGatewayReference { + /** + * Create a VirtualNetworkConnectionGatewayReference. + * @member {string} id The ID of VirtualNetworkGateway or LocalNetworkGateway + * resource. + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkConnectionGatewayReference + * + * @returns {object} metadata of VirtualNetworkConnectionGatewayReference + * + */ + mapper() { + return { + required: false, + serializedName: 'virtualNetworkConnectionGatewayReference', + type: { + name: 'Composite', + className: 'VirtualNetworkConnectionGatewayReference', + modelProperties: { + id: { + required: true, + serializedName: 'id', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkConnectionGatewayReference; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGateway.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGateway.js new file mode 100644 index 0000000000..a8853085dc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGateway.js @@ -0,0 +1,251 @@ +/* + * 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'); + +/** + * A common class for general resource information + * + * @extends models['Resource'] + */ +class VirtualNetworkGateway extends models['Resource'] { + /** + * Create a VirtualNetworkGateway. + * @member {array} [ipConfigurations] IP configurations for virtual network + * gateway. + * @member {string} [gatewayType] The type of this virtual network gateway. + * Possible values are: 'Vpn' and 'ExpressRoute'. Possible values include: + * 'Vpn', 'ExpressRoute' + * @member {string} [vpnType] The type of this virtual network gateway. + * Possible values are: 'PolicyBased' and 'RouteBased'. Possible values + * include: 'PolicyBased', 'RouteBased' + * @member {boolean} [enableBgp] Whether BGP is enabled for this virtual + * network gateway or not. + * @member {boolean} [activeActive] ActiveActive flag + * @member {object} [gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default + * site setting. + * @member {string} [gatewayDefaultSite.id] Resource ID. + * @member {object} [sku] The reference of the VirtualNetworkGatewaySku + * resource which represents the SKU selected for Virtual network gateway. + * @member {string} [sku.name] Gateway SKU name. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {string} [sku.tier] Gateway SKU tier. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {number} [sku.capacity] The capacity. + * @member {object} [vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * @member {object} [vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * @member {array} + * [vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * @member {array} [vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} [vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} [vpnClientConfiguration.radiusServerAddress] The radius + * server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * @member {string} [vpnClientConfiguration.radiusServerSecret] The radius + * secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * @member {object} [bgpSettings] Virtual network gateway's BGP speaker + * settings. + * @member {number} [bgpSettings.asn] The BGP speaker's ASN. + * @member {string} [bgpSettings.bgpPeeringAddress] The BGP peering address + * and BGP identifier of this BGP speaker. + * @member {number} [bgpSettings.peerWeight] The weight added to routes + * learned from this BGP speaker. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGateway resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGateway + * + * @returns {object} metadata of VirtualNetworkGateway + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGateway', + type: { + name: 'Composite', + className: 'VirtualNetworkGateway', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + ipConfigurations: { + required: false, + serializedName: 'properties.ipConfigurations', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkGatewayIPConfigurationElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayIPConfiguration' + } + } + } + }, + gatewayType: { + required: false, + serializedName: 'properties.gatewayType', + type: { + name: 'String' + } + }, + vpnType: { + required: false, + serializedName: 'properties.vpnType', + type: { + name: 'String' + } + }, + enableBgp: { + required: false, + serializedName: 'properties.enableBgp', + type: { + name: 'Boolean' + } + }, + activeActive: { + required: false, + serializedName: 'properties.activeActive', + type: { + name: 'Boolean' + } + }, + gatewayDefaultSite: { + required: false, + serializedName: 'properties.gatewayDefaultSite', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + sku: { + required: false, + serializedName: 'properties.sku', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewaySku' + } + }, + vpnClientConfiguration: { + required: false, + serializedName: 'properties.vpnClientConfiguration', + type: { + name: 'Composite', + className: 'VpnClientConfiguration' + } + }, + bgpSettings: { + required: false, + serializedName: 'properties.bgpSettings', + type: { + name: 'Composite', + className: 'BgpSettings' + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGateway; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnection.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnection.js new file mode 100644 index 0000000000..b6dc8791ef --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnection.js @@ -0,0 +1,447 @@ +/* + * 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'); + +/** + * A common class for general resource information + * + * @extends models['Resource'] + */ +class VirtualNetworkGatewayConnection extends models['Resource'] { + /** + * Create a VirtualNetworkGatewayConnection. + * @member {string} [authorizationKey] The authorizationKey. + * @member {object} virtualNetworkGateway1 The reference to virtual network + * gateway resource. + * @member {array} [virtualNetworkGateway1.ipConfigurations] IP + * configurations for virtual network gateway. + * @member {string} [virtualNetworkGateway1.gatewayType] The type of this + * virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * @member {string} [virtualNetworkGateway1.vpnType] The type of this virtual + * network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. + * Possible values include: 'PolicyBased', 'RouteBased' + * @member {boolean} [virtualNetworkGateway1.enableBgp] Whether BGP is + * enabled for this virtual network gateway or not. + * @member {boolean} [virtualNetworkGateway1.activeActive] ActiveActive flag + * @member {object} [virtualNetworkGateway1.gatewayDefaultSite] The reference + * of the LocalNetworkGateway resource which represents local network site + * having default routes. Assign Null value in case of removing existing + * default site setting. + * @member {string} [virtualNetworkGateway1.gatewayDefaultSite.id] Resource + * ID. + * @member {object} [virtualNetworkGateway1.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * @member {string} [virtualNetworkGateway1.sku.name] Gateway SKU name. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {string} [virtualNetworkGateway1.sku.tier] Gateway SKU tier. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {number} [virtualNetworkGateway1.sku.capacity] The capacity. + * @member {object} [virtualNetworkGateway1.vpnClientConfiguration] The + * reference of the VpnClientConfiguration resource which represents the P2S + * VpnClient configurations. + * @member {object} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] + * A list of address blocks reserved for this virtual network in CIDR + * notation. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway1.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} + * [virtualNetworkGateway1.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * @member {string} + * [virtualNetworkGateway1.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * @member {object} [virtualNetworkGateway1.bgpSettings] Virtual network + * gateway's BGP speaker settings. + * @member {number} [virtualNetworkGateway1.bgpSettings.asn] The BGP + * speaker's ASN. + * @member {string} [virtualNetworkGateway1.bgpSettings.bgpPeeringAddress] + * The BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [virtualNetworkGateway1.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * @member {string} [virtualNetworkGateway1.resourceGuid] The resource GUID + * property of the VirtualNetworkGateway resource. + * @member {string} [virtualNetworkGateway1.provisioningState] The + * provisioning state of the VirtualNetworkGateway resource. Possible values + * are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [virtualNetworkGateway1.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * @member {object} [virtualNetworkGateway2] The reference to virtual network + * gateway resource. + * @member {array} [virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * @member {string} [virtualNetworkGateway2.gatewayType] The type of this + * virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * @member {string} [virtualNetworkGateway2.vpnType] The type of this virtual + * network gateway. Possible values are: 'PolicyBased' and 'RouteBased'. + * Possible values include: 'PolicyBased', 'RouteBased' + * @member {boolean} [virtualNetworkGateway2.enableBgp] Whether BGP is + * enabled for this virtual network gateway or not. + * @member {boolean} [virtualNetworkGateway2.activeActive] ActiveActive flag + * @member {object} [virtualNetworkGateway2.gatewayDefaultSite] The reference + * of the LocalNetworkGateway resource which represents local network site + * having default routes. Assign Null value in case of removing existing + * default site setting. + * @member {string} [virtualNetworkGateway2.gatewayDefaultSite.id] Resource + * ID. + * @member {object} [virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * @member {string} [virtualNetworkGateway2.sku.name] Gateway SKU name. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {string} [virtualNetworkGateway2.sku.tier] Gateway SKU tier. + * Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * @member {number} [virtualNetworkGateway2.sku.capacity] The capacity. + * @member {object} [virtualNetworkGateway2.vpnClientConfiguration] The + * reference of the VpnClientConfiguration resource which represents the P2S + * VpnClient configurations. + * @member {object} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] + * A list of address blocks reserved for this virtual network in CIDR + * notation. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * @member {array} + * [virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * @member {string} + * [virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * @member {string} + * [virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * @member {object} [virtualNetworkGateway2.bgpSettings] Virtual network + * gateway's BGP speaker settings. + * @member {number} [virtualNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * @member {string} [virtualNetworkGateway2.bgpSettings.bgpPeeringAddress] + * The BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [virtualNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * @member {string} [virtualNetworkGateway2.resourceGuid] The resource GUID + * property of the VirtualNetworkGateway resource. + * @member {string} [virtualNetworkGateway2.provisioningState] The + * provisioning state of the VirtualNetworkGateway resource. Possible values + * are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [virtualNetworkGateway2.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * @member {object} [localNetworkGateway2] The reference to local network + * gateway resource. + * @member {object} [localNetworkGateway2.localNetworkAddressSpace] Local + * network site address space. + * @member {array} + * [localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A list of + * address blocks reserved for this virtual network in CIDR notation. + * @member {string} [localNetworkGateway2.gatewayIpAddress] IP address of + * local network gateway. + * @member {object} [localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * @member {number} [localNetworkGateway2.bgpSettings.asn] The BGP speaker's + * ASN. + * @member {string} [localNetworkGateway2.bgpSettings.bgpPeeringAddress] The + * BGP peering address and BGP identifier of this BGP speaker. + * @member {number} [localNetworkGateway2.bgpSettings.peerWeight] The weight + * added to routes learned from this BGP speaker. + * @member {string} [localNetworkGateway2.resourceGuid] The resource GUID + * property of the LocalNetworkGateway resource. + * @member {string} [localNetworkGateway2.provisioningState] The provisioning + * state of the LocalNetworkGateway resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * @member {string} [localNetworkGateway2.etag] A unique read-only string + * that changes whenever the resource is updated. + * @member {string} connectionType Gateway connection type. Possible values + * are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible values + * include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * @member {number} [routingWeight] The routing weight. + * @member {string} [sharedKey] The IPSec shared key. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values are 'Unknown', 'Connecting', 'Connected' and + * 'NotConnected'. Possible values include: 'Unknown', 'Connecting', + * 'Connected', 'NotConnected' + * @member {array} [tunnelConnectionStatus] Collection of all tunnels' + * connection health status. + * @member {number} [egressBytesTransferred] The egress bytes transferred in + * this connection. + * @member {number} [ingressBytesTransferred] The ingress bytes transferred + * in this connection. + * @member {object} [peer] The reference to peerings resource. + * @member {string} [peer.id] Resource ID. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {boolean} [usePolicyBasedTrafficSelectors] Enable policy-based + * traffic selectors. + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by + * this connection. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGatewayConnection resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayConnection + * + * @returns {object} metadata of VirtualNetworkGatewayConnection + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayConnection', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayConnection', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + authorizationKey: { + required: false, + serializedName: 'properties.authorizationKey', + type: { + name: 'String' + } + }, + virtualNetworkGateway1: { + required: true, + serializedName: 'properties.virtualNetworkGateway1', + type: { + name: 'Composite', + className: 'VirtualNetworkGateway' + } + }, + virtualNetworkGateway2: { + required: false, + serializedName: 'properties.virtualNetworkGateway2', + type: { + name: 'Composite', + className: 'VirtualNetworkGateway' + } + }, + localNetworkGateway2: { + required: false, + serializedName: 'properties.localNetworkGateway2', + type: { + name: 'Composite', + className: 'LocalNetworkGateway' + } + }, + connectionType: { + required: true, + serializedName: 'properties.connectionType', + type: { + name: 'String' + } + }, + routingWeight: { + required: false, + serializedName: 'properties.routingWeight', + type: { + name: 'Number' + } + }, + sharedKey: { + required: false, + serializedName: 'properties.sharedKey', + type: { + name: 'String' + } + }, + connectionStatus: { + required: false, + readOnly: true, + serializedName: 'properties.connectionStatus', + type: { + name: 'String' + } + }, + tunnelConnectionStatus: { + required: false, + readOnly: true, + serializedName: 'properties.tunnelConnectionStatus', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TunnelConnectionHealthElementType', + type: { + name: 'Composite', + className: 'TunnelConnectionHealth' + } + } + } + }, + egressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.egressBytesTransferred', + type: { + name: 'Number' + } + }, + ingressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.ingressBytesTransferred', + type: { + name: 'Number' + } + }, + peer: { + required: false, + serializedName: 'properties.peer', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + enableBgp: { + required: false, + serializedName: 'properties.enableBgp', + type: { + name: 'Boolean' + } + }, + usePolicyBasedTrafficSelectors: { + required: false, + serializedName: 'properties.usePolicyBasedTrafficSelectors', + type: { + name: 'Boolean' + } + }, + ipsecPolicies: { + required: false, + serializedName: 'properties.ipsecPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IpsecPolicyElementType', + type: { + name: 'Composite', + className: 'IpsecPolicy' + } + } + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayConnection; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListEntity.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListEntity.js new file mode 100644 index 0000000000..12183ef6db --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListEntity.js @@ -0,0 +1,285 @@ +/* + * 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'); + +/** + * A common class for general resource information + * + * @extends models['Resource'] + */ +class VirtualNetworkGatewayConnectionListEntity extends models['Resource'] { + /** + * Create a VirtualNetworkGatewayConnectionListEntity. + * @member {string} [authorizationKey] The authorizationKey. + * @member {object} virtualNetworkGateway1 The reference to virtual network + * gateway resource. + * @member {string} [virtualNetworkGateway1.id] The ID of + * VirtualNetworkGateway or LocalNetworkGateway resource. + * @member {object} [virtualNetworkGateway2] The reference to virtual network + * gateway resource. + * @member {string} [virtualNetworkGateway2.id] The ID of + * VirtualNetworkGateway or LocalNetworkGateway resource. + * @member {object} [localNetworkGateway2] The reference to local network + * gateway resource. + * @member {string} [localNetworkGateway2.id] The ID of VirtualNetworkGateway + * or LocalNetworkGateway resource. + * @member {string} connectionType Gateway connection type. Possible values + * are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible values + * include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * @member {number} [routingWeight] The routing weight. + * @member {string} [sharedKey] The IPSec shared key. + * @member {string} [connectionStatus] Virtual network Gateway connection + * status. Possible values are 'Unknown', 'Connecting', 'Connected' and + * 'NotConnected'. Possible values include: 'Unknown', 'Connecting', + * 'Connected', 'NotConnected' + * @member {array} [tunnelConnectionStatus] Collection of all tunnels' + * connection health status. + * @member {number} [egressBytesTransferred] The egress bytes transferred in + * this connection. + * @member {number} [ingressBytesTransferred] The ingress bytes transferred + * in this connection. + * @member {object} [peer] The reference to peerings resource. + * @member {string} [peer.id] Resource ID. + * @member {boolean} [enableBgp] EnableBgp flag + * @member {boolean} [usePolicyBasedTrafficSelectors] Enable policy-based + * traffic selectors. + * @member {array} [ipsecPolicies] The IPSec Policies to be considered by + * this connection. + * @member {string} [resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * @member {string} [provisioningState] The provisioning state of the + * VirtualNetworkGatewayConnection resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [etag] Gets a unique read-only string that changes + * whenever the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayConnectionListEntity + * + * @returns {object} metadata of VirtualNetworkGatewayConnectionListEntity + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayConnectionListEntity', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayConnectionListEntity', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'String' + } + }, + type: { + required: false, + readOnly: true, + serializedName: 'type', + type: { + name: 'String' + } + }, + location: { + required: false, + serializedName: 'location', + type: { + name: 'String' + } + }, + tags: { + required: false, + serializedName: 'tags', + type: { + name: 'Dictionary', + value: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + authorizationKey: { + required: false, + serializedName: 'properties.authorizationKey', + type: { + name: 'String' + } + }, + virtualNetworkGateway1: { + required: true, + serializedName: 'properties.virtualNetworkGateway1', + type: { + name: 'Composite', + className: 'VirtualNetworkConnectionGatewayReference' + } + }, + virtualNetworkGateway2: { + required: false, + serializedName: 'properties.virtualNetworkGateway2', + type: { + name: 'Composite', + className: 'VirtualNetworkConnectionGatewayReference' + } + }, + localNetworkGateway2: { + required: false, + serializedName: 'properties.localNetworkGateway2', + type: { + name: 'Composite', + className: 'VirtualNetworkConnectionGatewayReference' + } + }, + connectionType: { + required: true, + serializedName: 'properties.connectionType', + type: { + name: 'String' + } + }, + routingWeight: { + required: false, + serializedName: 'properties.routingWeight', + type: { + name: 'Number' + } + }, + sharedKey: { + required: false, + serializedName: 'properties.sharedKey', + type: { + name: 'String' + } + }, + connectionStatus: { + required: false, + readOnly: true, + serializedName: 'properties.connectionStatus', + type: { + name: 'String' + } + }, + tunnelConnectionStatus: { + required: false, + readOnly: true, + serializedName: 'properties.tunnelConnectionStatus', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'TunnelConnectionHealthElementType', + type: { + name: 'Composite', + className: 'TunnelConnectionHealth' + } + } + } + }, + egressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.egressBytesTransferred', + type: { + name: 'Number' + } + }, + ingressBytesTransferred: { + required: false, + readOnly: true, + serializedName: 'properties.ingressBytesTransferred', + type: { + name: 'Number' + } + }, + peer: { + required: false, + serializedName: 'properties.peer', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + enableBgp: { + required: false, + serializedName: 'properties.enableBgp', + type: { + name: 'Boolean' + } + }, + usePolicyBasedTrafficSelectors: { + required: false, + serializedName: 'properties.usePolicyBasedTrafficSelectors', + type: { + name: 'Boolean' + } + }, + ipsecPolicies: { + required: false, + serializedName: 'properties.ipsecPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IpsecPolicyElementType', + type: { + name: 'Composite', + className: 'IpsecPolicy' + } + } + } + }, + resourceGuid: { + required: false, + serializedName: 'properties.resourceGuid', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayConnectionListEntity; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListResult.js new file mode 100644 index 0000000000..6572635654 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayConnectionListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the ListVirtualNetworkGatewayConnections API service call + */ +class VirtualNetworkGatewayConnectionListResult extends Array { + /** + * Create a VirtualNetworkGatewayConnectionListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayConnectionListResult + * + * @returns {object} metadata of VirtualNetworkGatewayConnectionListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayConnectionListResult', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayConnectionListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkGatewayConnectionElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayConnection' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayConnectionListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayIPConfiguration.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayIPConfiguration.js new file mode 100644 index 0000000000..704ba94ddd --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayIPConfiguration.js @@ -0,0 +1,114 @@ +/* + * 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'); + +/** + * IP configuration for virtual network gateway + * + * @extends models['SubResource'] + */ +class VirtualNetworkGatewayIPConfiguration extends models['SubResource'] { + /** + * Create a VirtualNetworkGatewayIPConfiguration. + * @member {string} [privateIPAllocationMethod] The private IP allocation + * method. Possible values are: 'Static' and 'Dynamic'. Possible values + * include: 'Static', 'Dynamic' + * @member {object} [subnet] The reference of the subnet resource. + * @member {string} [subnet.id] Resource ID. + * @member {object} [publicIPAddress] The reference of the public IP + * resource. + * @member {string} [publicIPAddress.id] Resource ID. + * @member {string} [provisioningState] The provisioning state of the public + * IP resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayIPConfiguration + * + * @returns {object} metadata of VirtualNetworkGatewayIPConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayIPConfiguration', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayIPConfiguration', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + privateIPAllocationMethod: { + required: false, + serializedName: 'properties.privateIPAllocationMethod', + type: { + name: 'String' + } + }, + subnet: { + required: false, + serializedName: 'properties.subnet', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + publicIPAddress: { + required: false, + serializedName: 'properties.publicIPAddress', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayIPConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListConnectionsResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListConnectionsResult.js new file mode 100644 index 0000000000..b2ad2405b1 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListConnectionsResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the VirtualNetworkGatewayListConnections API service call + */ +class VirtualNetworkGatewayListConnectionsResult extends Array { + /** + * Create a VirtualNetworkGatewayListConnectionsResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayListConnectionsResult + * + * @returns {object} metadata of VirtualNetworkGatewayListConnectionsResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayListConnectionsResult', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayListConnectionsResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkGatewayConnectionListEntityElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayConnectionListEntity' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayListConnectionsResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListResult.js new file mode 100644 index 0000000000..7daeceaa76 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewayListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the ListVirtualNetworkGateways API service call. + */ +class VirtualNetworkGatewayListResult extends Array { + /** + * Create a VirtualNetworkGatewayListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkGatewayListResult + * + * @returns {object} metadata of VirtualNetworkGatewayListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewayListResult', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewayListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkGatewayElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkGateway' + } + } + } + }, + nextLink: { + required: false, + readOnly: true, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewayListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewaySku.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewaySku.js new file mode 100644 index 0000000000..cea2349ade --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkGatewaySku.js @@ -0,0 +1,72 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * VirtualNetworkGatewaySku details + * + */ +class VirtualNetworkGatewaySku { + /** + * Create a VirtualNetworkGatewaySku. + * @member {string} [name] Gateway SKU name. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {string} [tier] Gateway SKU tier. Possible values include: + * 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', 'VpnGw1', + * 'VpnGw2', 'VpnGw3' + * @member {number} [capacity] The capacity. + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkGatewaySku + * + * @returns {object} metadata of VirtualNetworkGatewaySku + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkGatewaySku', + type: { + name: 'Composite', + className: 'VirtualNetworkGatewaySku', + modelProperties: { + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + tier: { + required: false, + serializedName: 'tier', + type: { + name: 'String' + } + }, + capacity: { + required: false, + serializedName: 'capacity', + type: { + name: 'Number' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkGatewaySku; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkListResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkListResult.js new file mode 100644 index 0000000000..d578f54820 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkListResult.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'; + +/** + * Response for the ListVirtualNetworks API service call. + */ +class VirtualNetworkListResult extends Array { + /** + * Create a VirtualNetworkListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkListResult + * + * @returns {object} metadata of VirtualNetworkListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkListResult', + type: { + name: 'Composite', + className: 'VirtualNetworkListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkElementType', + type: { + name: 'Composite', + className: 'VirtualNetwork' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkListUsageResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkListUsageResult.js new file mode 100644 index 0000000000..633640ecb3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkListUsageResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for the virtual networks GetUsage API service call. + */ +class VirtualNetworkListUsageResult extends Array { + /** + * Create a VirtualNetworkListUsageResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkListUsageResult + * + * @returns {object} metadata of VirtualNetworkListUsageResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkListUsageResult', + type: { + name: 'Composite', + className: 'VirtualNetworkListUsageResult', + modelProperties: { + value: { + required: false, + readOnly: true, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkUsageElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkUsage' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkListUsageResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeering.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeering.js new file mode 100644 index 0000000000..813b33c2b0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeering.js @@ -0,0 +1,159 @@ +/* + * 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'); + +/** + * Peerings in a virtual network resource. + * + * @extends models['SubResource'] + */ +class VirtualNetworkPeering extends models['SubResource'] { + /** + * Create a VirtualNetworkPeering. + * @member {boolean} [allowVirtualNetworkAccess] Whether the VMs in the + * linked virtual network space would be able to access all the VMs in local + * Virtual network space. + * @member {boolean} [allowForwardedTraffic] Whether the forwarded traffic + * from the VMs in the remote virtual network will be allowed/disallowed. + * @member {boolean} [allowGatewayTransit] If gateway links can be used in + * remote virtual networking to link to this virtual network. + * @member {boolean} [useRemoteGateways] If remote gateways can be used on + * this virtual network. If the flag is set to true, and allowGatewayTransit + * on remote peering is also true, virtual network will use gateways of + * remote virtual network for transit. Only one peering can have this flag + * set to true. This flag cannot be set if virtual network already has a + * gateway. + * @member {object} [remoteVirtualNetwork] The reference of the remote + * virtual network. The remote virtual network can be in the same or + * different region (preview). See here to register for the preview and learn + * more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * @member {string} [remoteVirtualNetwork.id] Resource ID. + * @member {object} [remoteAddressSpace] The reference of the remote virtual + * network address space. + * @member {array} [remoteAddressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * @member {string} [peeringState] The status of the virtual network peering. + * Possible values are 'Initiated', 'Connected', and 'Disconnected'. Possible + * values include: 'Initiated', 'Connected', 'Disconnected' + * @member {string} [provisioningState] The provisioning state of the + * resource. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkPeering + * + * @returns {object} metadata of VirtualNetworkPeering + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkPeering', + type: { + name: 'Composite', + className: 'VirtualNetworkPeering', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + allowVirtualNetworkAccess: { + required: false, + serializedName: 'properties.allowVirtualNetworkAccess', + type: { + name: 'Boolean' + } + }, + allowForwardedTraffic: { + required: false, + serializedName: 'properties.allowForwardedTraffic', + type: { + name: 'Boolean' + } + }, + allowGatewayTransit: { + required: false, + serializedName: 'properties.allowGatewayTransit', + type: { + name: 'Boolean' + } + }, + useRemoteGateways: { + required: false, + serializedName: 'properties.useRemoteGateways', + type: { + name: 'Boolean' + } + }, + remoteVirtualNetwork: { + required: false, + serializedName: 'properties.remoteVirtualNetwork', + type: { + name: 'Composite', + className: 'SubResource' + } + }, + remoteAddressSpace: { + required: false, + serializedName: 'properties.remoteAddressSpace', + type: { + name: 'Composite', + className: 'AddressSpace' + } + }, + peeringState: { + required: false, + serializedName: 'properties.peeringState', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkPeering; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeeringListResult.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeeringListResult.js new file mode 100644 index 0000000000..f3ee98739a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkPeeringListResult.js @@ -0,0 +1,68 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Response for ListSubnets API service call. Retrieves all subnets that belong + * to a virtual network. + */ +class VirtualNetworkPeeringListResult extends Array { + /** + * Create a VirtualNetworkPeeringListResult. + * @member {string} [nextLink] The URL to get the next set of results. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VirtualNetworkPeeringListResult + * + * @returns {object} metadata of VirtualNetworkPeeringListResult + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkPeeringListResult', + type: { + name: 'Composite', + className: 'VirtualNetworkPeeringListResult', + modelProperties: { + value: { + required: false, + serializedName: '', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VirtualNetworkPeeringElementType', + type: { + name: 'Composite', + className: 'VirtualNetworkPeering' + } + } + } + }, + nextLink: { + required: false, + serializedName: 'nextLink', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkPeeringListResult; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsage.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsage.js new file mode 100644 index 0000000000..d599549cb5 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsage.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'; + +const models = require('./index'); + +/** + * Usage details for subnet. + * + */ +class VirtualNetworkUsage { + /** + * Create a VirtualNetworkUsage. + * @member {number} [currentValue] Indicates number of IPs used from the + * Subnet. + * @member {string} [id] Subnet identifier. + * @member {number} [limit] Indicates the size of the subnet. + * @member {object} [name] The name containing common and localized value for + * usage. + * @member {string} [name.localizedValue] Localized subnet size and usage + * string. + * @member {string} [name.value] Subnet size and usage string. + * @member {string} [unit] Usage units. Returns 'Count' + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkUsage + * + * @returns {object} metadata of VirtualNetworkUsage + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkUsage', + type: { + name: 'Composite', + className: 'VirtualNetworkUsage', + modelProperties: { + currentValue: { + required: false, + readOnly: true, + serializedName: 'currentValue', + type: { + name: 'Number' + } + }, + id: { + required: false, + readOnly: true, + serializedName: 'id', + type: { + name: 'String' + } + }, + limit: { + required: false, + readOnly: true, + serializedName: 'limit', + type: { + name: 'Number' + } + }, + name: { + required: false, + readOnly: true, + serializedName: 'name', + type: { + name: 'Composite', + className: 'VirtualNetworkUsageName' + } + }, + unit: { + required: false, + readOnly: true, + serializedName: 'unit', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkUsage; diff --git a/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsageName.js b/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsageName.js new file mode 100644 index 0000000000..093951db51 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/virtualNetworkUsageName.js @@ -0,0 +1,62 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Usage strings container. + * + */ +class VirtualNetworkUsageName { + /** + * Create a VirtualNetworkUsageName. + * @member {string} [localizedValue] Localized subnet size and usage string. + * @member {string} [value] Subnet size and usage string. + */ + constructor() { + } + + /** + * Defines the metadata of VirtualNetworkUsageName + * + * @returns {object} metadata of VirtualNetworkUsageName + * + */ + mapper() { + return { + required: false, + serializedName: 'VirtualNetworkUsageName', + type: { + name: 'Composite', + className: 'VirtualNetworkUsageName', + modelProperties: { + localizedValue: { + required: false, + readOnly: true, + serializedName: 'localizedValue', + type: { + name: 'String' + } + }, + value: { + required: false, + readOnly: true, + serializedName: 'value', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VirtualNetworkUsageName; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnClientConfiguration.js b/lib/services/networkManagement2/lib/lib/models/vpnClientConfiguration.js new file mode 100644 index 0000000000..b4f14facc0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnClientConfiguration.js @@ -0,0 +1,143 @@ +/* + * 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'); + +/** + * VpnClientConfiguration for P2S client. + * + */ +class VpnClientConfiguration { + /** + * Create a VpnClientConfiguration. + * @member {object} [vpnClientAddressPool] The reference of the address space + * resource which represents Address space for P2S VpnClient. + * @member {array} [vpnClientAddressPool.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * @member {array} [vpnClientRootCertificates] VpnClientRootCertificate for + * virtual network gateway. + * @member {array} [vpnClientRevokedCertificates] VpnClientRevokedCertificate + * for Virtual network gateway. + * @member {array} [vpnClientProtocols] VpnClientProtocols for Virtual + * network gateway. + * @member {array} [vpnClientIpsecPolicies] VpnClientIpsecPolicies for + * virtual network gateway P2S client. + * @member {string} [radiusServerAddress] The radius server address property + * of the VirtualNetworkGateway resource for vpn client connection. + * @member {string} [radiusServerSecret] The radius secret property of the + * VirtualNetworkGateway resource for vpn client connection. + */ + constructor() { + } + + /** + * Defines the metadata of VpnClientConfiguration + * + * @returns {object} metadata of VpnClientConfiguration + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnClientConfiguration', + type: { + name: 'Composite', + className: 'VpnClientConfiguration', + modelProperties: { + vpnClientAddressPool: { + required: false, + serializedName: 'vpnClientAddressPool', + type: { + name: 'Composite', + className: 'AddressSpace' + } + }, + vpnClientRootCertificates: { + required: false, + serializedName: 'vpnClientRootCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnClientRootCertificateElementType', + type: { + name: 'Composite', + className: 'VpnClientRootCertificate' + } + } + } + }, + vpnClientRevokedCertificates: { + required: false, + serializedName: 'vpnClientRevokedCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'VpnClientRevokedCertificateElementType', + type: { + name: 'Composite', + className: 'VpnClientRevokedCertificate' + } + } + } + }, + vpnClientProtocols: { + required: false, + serializedName: 'vpnClientProtocols', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + }, + vpnClientIpsecPolicies: { + required: false, + serializedName: 'vpnClientIpsecPolicies', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'IpsecPolicyElementType', + type: { + name: 'Composite', + className: 'IpsecPolicy' + } + } + } + }, + radiusServerAddress: { + required: false, + serializedName: 'radiusServerAddress', + type: { + name: 'String' + } + }, + radiusServerSecret: { + required: false, + serializedName: 'radiusServerSecret', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnClientConfiguration; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnClientIPsecParameters.js b/lib/services/networkManagement2/lib/lib/models/vpnClientIPsecParameters.js new file mode 100644 index 0000000000..b166295913 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnClientIPsecParameters.js @@ -0,0 +1,122 @@ +/* + * 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'; + +/** + * An IPSec parameters for a virtual network gateway P2S connection. + * + */ +class VpnClientIPsecParameters { + /** + * Create a VpnClientIPsecParameters. + * @member {number} saLifeTimeSeconds The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) lifetime in seconds for P2S client. + * @member {number} saDataSizeKilobytes The IPSec Security Association (also + * called Quick Mode or Phase 2 SA) payload size in KB for P2S client.. + * @member {string} ipsecEncryption The IPSec encryption algorithm (IKE phase + * 1). Possible values include: 'None', 'DES', 'DES3', 'AES128', 'AES192', + * 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * @member {string} ipsecIntegrity The IPSec integrity algorithm (IKE phase + * 1). Possible values include: 'MD5', 'SHA1', 'SHA256', 'GCMAES128', + * 'GCMAES192', 'GCMAES256' + * @member {string} ikeEncryption The IKE encryption algorithm (IKE phase 2). + * Possible values include: 'DES', 'DES3', 'AES128', 'AES192', 'AES256', + * 'GCMAES256', 'GCMAES128' + * @member {string} ikeIntegrity The IKE integrity algorithm (IKE phase 2). + * Possible values include: 'MD5', 'SHA1', 'SHA256', 'SHA384', 'GCMAES256', + * 'GCMAES128' + * @member {string} dhGroup The DH Groups used in IKE Phase 1 for initial SA. + * Possible values include: 'None', 'DHGroup1', 'DHGroup2', 'DHGroup14', + * 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * @member {string} pfsGroup The Pfs Groups used in IKE Phase 2 for new child + * SA. Possible values include: 'None', 'PFS1', 'PFS2', 'PFS2048', 'ECP256', + * 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + */ + constructor() { + } + + /** + * Defines the metadata of VpnClientIPsecParameters + * + * @returns {object} metadata of VpnClientIPsecParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnClientIPsecParameters', + type: { + name: 'Composite', + className: 'VpnClientIPsecParameters', + modelProperties: { + saLifeTimeSeconds: { + required: true, + serializedName: 'saLifeTimeSeconds', + type: { + name: 'Number' + } + }, + saDataSizeKilobytes: { + required: true, + serializedName: 'saDataSizeKilobytes', + type: { + name: 'Number' + } + }, + ipsecEncryption: { + required: true, + serializedName: 'ipsecEncryption', + type: { + name: 'String' + } + }, + ipsecIntegrity: { + required: true, + serializedName: 'ipsecIntegrity', + type: { + name: 'String' + } + }, + ikeEncryption: { + required: true, + serializedName: 'ikeEncryption', + type: { + name: 'String' + } + }, + ikeIntegrity: { + required: true, + serializedName: 'ikeIntegrity', + type: { + name: 'String' + } + }, + dhGroup: { + required: true, + serializedName: 'dhGroup', + type: { + name: 'String' + } + }, + pfsGroup: { + required: true, + serializedName: 'pfsGroup', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnClientIPsecParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnClientParameters.js b/lib/services/networkManagement2/lib/lib/models/vpnClientParameters.js new file mode 100644 index 0000000000..f83ecb68a3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnClientParameters.js @@ -0,0 +1,92 @@ +/* + * 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'; + +/** + * Vpn Client Parameters for package generation + * + */ +class VpnClientParameters { + /** + * Create a VpnClientParameters. + * @member {string} [processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * @member {string} [authenticationMethod] VPN client Authentication Method. + * Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values include: + * 'EAPTLS', 'EAPMSCHAPv2' + * @member {string} [radiusServerAuthCertificate] The public certificate data + * for the radius server authentication certificate as a Base-64 encoded + * string. Required only if external radius authentication has been + * configured with EAPTLS authentication. + * @member {array} [clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + */ + constructor() { + } + + /** + * Defines the metadata of VpnClientParameters + * + * @returns {object} metadata of VpnClientParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnClientParameters', + type: { + name: 'Composite', + className: 'VpnClientParameters', + modelProperties: { + processorArchitecture: { + required: false, + serializedName: 'processorArchitecture', + type: { + name: 'String' + } + }, + authenticationMethod: { + required: false, + serializedName: 'authenticationMethod', + type: { + name: 'String' + } + }, + radiusServerAuthCertificate: { + required: false, + serializedName: 'radiusServerAuthCertificate', + type: { + name: 'String' + } + }, + clientRootCertificates: { + required: false, + serializedName: 'clientRootCertificates', + type: { + name: 'Sequence', + element: { + required: false, + serializedName: 'StringElementType', + type: { + name: 'String' + } + } + } + } + } + } + }; + } +} + +module.exports = VpnClientParameters; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnClientRevokedCertificate.js b/lib/services/networkManagement2/lib/lib/models/vpnClientRevokedCertificate.js new file mode 100644 index 0000000000..6765ec0de6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnClientRevokedCertificate.js @@ -0,0 +1,93 @@ +/* + * 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'); + +/** + * VPN client revoked certificate of virtual network gateway. + * + * @extends models['SubResource'] + */ +class VpnClientRevokedCertificate extends models['SubResource'] { + /** + * Create a VpnClientRevokedCertificate. + * @member {string} [thumbprint] The revoked VPN client certificate + * thumbprint. + * @member {string} [provisioningState] The provisioning state of the VPN + * client revoked certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VpnClientRevokedCertificate + * + * @returns {object} metadata of VpnClientRevokedCertificate + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnClientRevokedCertificate', + type: { + name: 'Composite', + className: 'VpnClientRevokedCertificate', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + thumbprint: { + required: false, + serializedName: 'properties.thumbprint', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnClientRevokedCertificate; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnClientRootCertificate.js b/lib/services/networkManagement2/lib/lib/models/vpnClientRootCertificate.js new file mode 100644 index 0000000000..c37cf3e0db --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnClientRootCertificate.js @@ -0,0 +1,92 @@ +/* + * 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'); + +/** + * VPN client root certificate of virtual network gateway + * + * @extends models['SubResource'] + */ +class VpnClientRootCertificate extends models['SubResource'] { + /** + * Create a VpnClientRootCertificate. + * @member {string} publicCertData The certificate public data. + * @member {string} [provisioningState] The provisioning state of the VPN + * client root certificate resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * @member {string} [name] The name of the resource that is unique within a + * resource group. This name can be used to access the resource. + * @member {string} [etag] A unique read-only string that changes whenever + * the resource is updated. + */ + constructor() { + super(); + } + + /** + * Defines the metadata of VpnClientRootCertificate + * + * @returns {object} metadata of VpnClientRootCertificate + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnClientRootCertificate', + type: { + name: 'Composite', + className: 'VpnClientRootCertificate', + modelProperties: { + id: { + required: false, + serializedName: 'id', + type: { + name: 'String' + } + }, + publicCertData: { + required: true, + serializedName: 'properties.publicCertData', + type: { + name: 'String' + } + }, + provisioningState: { + required: false, + readOnly: true, + serializedName: 'properties.provisioningState', + type: { + name: 'String' + } + }, + name: { + required: false, + serializedName: 'name', + type: { + name: 'String' + } + }, + etag: { + required: false, + serializedName: 'etag', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnClientRootCertificate; diff --git a/lib/services/networkManagement2/lib/lib/models/vpnDeviceScriptParameters.js b/lib/services/networkManagement2/lib/lib/models/vpnDeviceScriptParameters.js new file mode 100644 index 0000000000..ff0a58c30b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/models/vpnDeviceScriptParameters.js @@ -0,0 +1,69 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +/** + * Vpn device configuration script generation parameters + * + */ +class VpnDeviceScriptParameters { + /** + * Create a VpnDeviceScriptParameters. + * @member {string} [vendor] The vendor for the vpn device. + * @member {string} [deviceFamily] The device family for the vpn device. + * @member {string} [firmwareVersion] The firmware version for the vpn + * device. + */ + constructor() { + } + + /** + * Defines the metadata of VpnDeviceScriptParameters + * + * @returns {object} metadata of VpnDeviceScriptParameters + * + */ + mapper() { + return { + required: false, + serializedName: 'VpnDeviceScriptParameters', + type: { + name: 'Composite', + className: 'VpnDeviceScriptParameters', + modelProperties: { + vendor: { + required: false, + serializedName: 'vendor', + type: { + name: 'String' + } + }, + deviceFamily: { + required: false, + serializedName: 'deviceFamily', + type: { + name: 'String' + } + }, + firmwareVersion: { + required: false, + serializedName: 'firmwareVersion', + type: { + name: 'String' + } + } + } + } + }; + } +} + +module.exports = VpnDeviceScriptParameters; diff --git a/lib/services/networkManagement2/lib/lib/networkManagementClient.d.ts b/lib/services/networkManagement2/lib/lib/networkManagementClient.d.ts new file mode 100644 index 0000000000..9286c83139 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/networkManagementClient.d.ts @@ -0,0 +1,166 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +import { ServiceClient, ServiceClientOptions, ServiceCallback, HttpOperationResponse, ServiceClientCredentials } from 'ms-rest'; +import { AzureServiceClient, AzureServiceClientOptions } from 'ms-rest-azure'; +import * as models from "./models"; +import * as operations from "./operations"; + +export default class NetworkManagementClient extends AzureServiceClient { + /** + * Initializes a new instance of the NetworkManagementClient class. + * @constructor + * + * @class + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * + * @param {string} subscriptionId - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param {string} [baseUri] - The base URI of the service. + * + * @param {object} [options] - The parameter options + * + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + */ + constructor(credentials: ServiceClientCredentials, subscriptionId: string, baseUri?: string, options?: AzureServiceClientOptions); + + credentials: ServiceClientCredentials; + + subscriptionId: string; + + apiVersion: string; + + acceptLanguage: string; + + longRunningOperationRetryTimeout: number; + + generateClientRequestId: boolean; + + // Operation groups + applicationGateways: operations.ApplicationGateways; + applicationSecurityGroups: operations.ApplicationSecurityGroups; + ddosProtectionPlans: operations.DdosProtectionPlans; + availableEndpointServices: operations.AvailableEndpointServices; + expressRouteCircuitAuthorizations: operations.ExpressRouteCircuitAuthorizations; + expressRouteCircuitPeerings: operations.ExpressRouteCircuitPeerings; + expressRouteCircuitConnections: operations.ExpressRouteCircuitConnections; + expressRouteCircuits: operations.ExpressRouteCircuits; + expressRouteServiceProviders: operations.ExpressRouteServiceProviders; + expressRouteCrossConnections: operations.ExpressRouteCrossConnections; + expressRouteCrossConnectionPeerings: operations.ExpressRouteCrossConnectionPeerings; + loadBalancers: operations.LoadBalancers; + loadBalancerBackendAddressPools: operations.LoadBalancerBackendAddressPools; + loadBalancerFrontendIPConfigurations: operations.LoadBalancerFrontendIPConfigurations; + inboundNatRules: operations.InboundNatRules; + loadBalancerLoadBalancingRules: operations.LoadBalancerLoadBalancingRules; + loadBalancerNetworkInterfaces: operations.LoadBalancerNetworkInterfaces; + loadBalancerProbes: operations.LoadBalancerProbes; + networkInterfaces: operations.NetworkInterfaces; + networkInterfaceIPConfigurations: operations.NetworkInterfaceIPConfigurations; + networkInterfaceLoadBalancers: operations.NetworkInterfaceLoadBalancers; + networkSecurityGroups: operations.NetworkSecurityGroups; + securityRules: operations.SecurityRules; + defaultSecurityRules: operations.DefaultSecurityRules; + networkWatchers: operations.NetworkWatchers; + packetCaptures: operations.PacketCaptures; + connectionMonitors: operations.ConnectionMonitors; + operations: operations.Operations; + publicIPAddresses: operations.PublicIPAddresses; + routeFilters: operations.RouteFilters; + routeFilterRules: operations.RouteFilterRules; + routeTables: operations.RouteTables; + routes: operations.Routes; + bgpServiceCommunities: operations.BgpServiceCommunities; + usages: operations.Usages; + virtualNetworks: operations.VirtualNetworks; + subnets: operations.Subnets; + virtualNetworkPeerings: operations.VirtualNetworkPeerings; + virtualNetworkGateways: operations.VirtualNetworkGateways; + virtualNetworkGatewayConnections: operations.VirtualNetworkGatewayConnections; + localNetworkGateways: operations.LocalNetworkGateways; + + + /** + * Checks whether a domain name in the cloudapp.azure.com zone is available for + * use. + * + * @param {string} location The location of the domain name. + * + * @param {string} domainNameLabel The domain name to be verified. It must + * conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * + * @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. + */ + checkDnsNameAvailabilityWithHttpOperationResponse(location: string, domainNameLabel: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks whether a domain name in the cloudapp.azure.com zone is available for + * use. + * + * @param {string} location The location of the domain name. + * + * @param {string} domainNameLabel The domain name to be verified. It must + * conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * + * @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 {DnsNameAvailabilityResult} - 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. + * + * {DnsNameAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link DnsNameAvailabilityResult} 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. + */ + checkDnsNameAvailability(location: string, domainNameLabel: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkDnsNameAvailability(location: string, domainNameLabel: string, callback: ServiceCallback): void; + checkDnsNameAvailability(location: string, domainNameLabel: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +export { NetworkManagementClient, models as NetworkManagementModels }; diff --git a/lib/services/networkManagement2/lib/lib/networkManagementClient.js b/lib/services/networkManagement2/lib/lib/networkManagementClient.js new file mode 100644 index 0000000000..77e297060f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/networkManagementClient.js @@ -0,0 +1,366 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const ServiceClient = msRestAzure.AzureServiceClient; +const WebResource = msRest.WebResource; + +const models = require('./models'); +const operations = require('./operations'); + + +/** + * Checks whether a domain name in the cloudapp.azure.com zone is available for + * use. + * + * @param {string} location The location of the domain name. + * + * @param {string} domainNameLabel The domain name to be verified. It must + * conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * + * @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 DnsNameAvailabilityResult} 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 _checkDnsNameAvailability(location, domainNameLabel, options, callback) { + /* jshint validthis: true */ + let client = this; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (domainNameLabel === null || domainNameLabel === undefined || typeof domainNameLabel.valueOf() !== 'string') { + throw new Error('domainNameLabel cannot be null or undefined and it must be of type string.'); + } + if (this.apiVersion === null || this.apiVersion === undefined || typeof this.apiVersion.valueOf() !== 'string') { + throw new Error('this.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.subscriptionId === null || this.subscriptionId === undefined || typeof this.subscriptionId.valueOf() !== 'string') { + throw new Error('this.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.acceptLanguage !== null && this.acceptLanguage !== undefined && typeof this.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability'; + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.subscriptionId)); + let queryParameters = []; + queryParameters.push('domainNameLabel=' + encodeURIComponent(domainNameLabel)); + queryParameters.push('api-version=' + encodeURIComponent(this.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.acceptLanguage !== undefined && this.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DnsNameAvailabilityResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a NetworkManagementClient. */ +class NetworkManagementClient extends ServiceClient { + /** + * Create a NetworkManagementClient. + * @param {credentials} credentials - Credentials needed for the client to connect to Azure. + * @param {string} subscriptionId - The subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * @param {string} [baseUri] - The base URI of the service. + * @param {object} [options] - The parameter options + * @param {Array} [options.filters] - Filters to be added to the request pipeline + * @param {object} [options.requestOptions] - Options for the underlying request object + * {@link https://github.com/request/request#requestoptions-callback Options doc} + * @param {boolean} [options.noRetryPolicy] - If set to true, turn off default retry policy + * @param {string} [options.acceptLanguage] - Gets or sets the preferred language for the response. + * @param {number} [options.longRunningOperationRetryTimeout] - Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * @param {boolean} [options.generateClientRequestId] - When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + */ + constructor(credentials, subscriptionId, baseUri, options) { + if (credentials === null || credentials === undefined) { + throw new Error('\'credentials\' cannot be null.'); + } + if (subscriptionId === null || subscriptionId === undefined) { + throw new Error('\'subscriptionId\' cannot be null.'); + } + + if (!options) options = {}; + + super(credentials, options); + + this.apiVersion = '2018-02-01'; + this.acceptLanguage = 'en-US'; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.baseUri = baseUri; + if (!this.baseUri) { + this.baseUri = 'https://management.azure.com'; + } + this.credentials = credentials; + this.subscriptionId = subscriptionId; + + let packageInfo = this.getPackageJsonInfo(__dirname); + this.addUserAgentInfo(`${packageInfo.name}/${packageInfo.version}`); + if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { + this.acceptLanguage = options.acceptLanguage; + } + if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { + this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; + } + if(options.generateClientRequestId !== null && options.generateClientRequestId !== undefined) { + this.generateClientRequestId = options.generateClientRequestId; + } + this.applicationGateways = new operations.ApplicationGateways(this); + this.applicationSecurityGroups = new operations.ApplicationSecurityGroups(this); + this.ddosProtectionPlans = new operations.DdosProtectionPlans(this); + this.availableEndpointServices = new operations.AvailableEndpointServices(this); + this.expressRouteCircuitAuthorizations = new operations.ExpressRouteCircuitAuthorizations(this); + this.expressRouteCircuitPeerings = new operations.ExpressRouteCircuitPeerings(this); + this.expressRouteCircuitConnections = new operations.ExpressRouteCircuitConnections(this); + this.expressRouteCircuits = new operations.ExpressRouteCircuits(this); + this.expressRouteServiceProviders = new operations.ExpressRouteServiceProviders(this); + this.expressRouteCrossConnections = new operations.ExpressRouteCrossConnections(this); + this.expressRouteCrossConnectionPeerings = new operations.ExpressRouteCrossConnectionPeerings(this); + this.loadBalancers = new operations.LoadBalancers(this); + this.loadBalancerBackendAddressPools = new operations.LoadBalancerBackendAddressPools(this); + this.loadBalancerFrontendIPConfigurations = new operations.LoadBalancerFrontendIPConfigurations(this); + this.inboundNatRules = new operations.InboundNatRules(this); + this.loadBalancerLoadBalancingRules = new operations.LoadBalancerLoadBalancingRules(this); + this.loadBalancerNetworkInterfaces = new operations.LoadBalancerNetworkInterfaces(this); + this.loadBalancerProbes = new operations.LoadBalancerProbes(this); + this.networkInterfaces = new operations.NetworkInterfaces(this); + this.networkInterfaceIPConfigurations = new operations.NetworkInterfaceIPConfigurations(this); + this.networkInterfaceLoadBalancers = new operations.NetworkInterfaceLoadBalancers(this); + this.networkSecurityGroups = new operations.NetworkSecurityGroups(this); + this.securityRules = new operations.SecurityRules(this); + this.defaultSecurityRules = new operations.DefaultSecurityRules(this); + this.networkWatchers = new operations.NetworkWatchers(this); + this.packetCaptures = new operations.PacketCaptures(this); + this.connectionMonitors = new operations.ConnectionMonitors(this); + this.operations = new operations.Operations(this); + this.publicIPAddresses = new operations.PublicIPAddresses(this); + this.routeFilters = new operations.RouteFilters(this); + this.routeFilterRules = new operations.RouteFilterRules(this); + this.routeTables = new operations.RouteTables(this); + this.routes = new operations.Routes(this); + this.bgpServiceCommunities = new operations.BgpServiceCommunities(this); + this.usages = new operations.Usages(this); + this.virtualNetworks = new operations.VirtualNetworks(this); + this.subnets = new operations.Subnets(this); + this.virtualNetworkPeerings = new operations.VirtualNetworkPeerings(this); + this.virtualNetworkGateways = new operations.VirtualNetworkGateways(this); + this.virtualNetworkGatewayConnections = new operations.VirtualNetworkGatewayConnections(this); + this.localNetworkGateways = new operations.LocalNetworkGateways(this); + this.models = models; + this._checkDnsNameAvailability = _checkDnsNameAvailability; + msRest.addSerializationMixin(this); + } + + /** + * Checks whether a domain name in the cloudapp.azure.com zone is available for + * use. + * + * @param {string} location The location of the domain name. + * + * @param {string} domainNameLabel The domain name to be verified. It must + * conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * + * @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. + */ + checkDnsNameAvailabilityWithHttpOperationResponse(location, domainNameLabel, options) { + let client = this; + let self = this; + return new Promise((resolve, reject) => { + self._checkDnsNameAvailability(location, domainNameLabel, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks whether a domain name in the cloudapp.azure.com zone is available for + * use. + * + * @param {string} location The location of the domain name. + * + * @param {string} domainNameLabel The domain name to be verified. It must + * conform to the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. + * + * @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 {DnsNameAvailabilityResult} - 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 DnsNameAvailabilityResult} 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. + */ + checkDnsNameAvailability(location, domainNameLabel, options, optionalCallback) { + let client = this; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._checkDnsNameAvailability(location, domainNameLabel, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkDnsNameAvailability(location, domainNameLabel, options, optionalCallback); + } + } + +} + +module.exports = NetworkManagementClient; +module.exports['default'] = NetworkManagementClient; +module.exports.NetworkManagementClient = NetworkManagementClient; +module.exports.NetworkManagementModels = models; diff --git a/lib/services/networkManagement2/lib/lib/operations/applicationGateways.js b/lib/services/networkManagement2/lib/lib/operations/applicationGateways.js new file mode 100644 index 0000000000..fd66cf450b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/applicationGateways.js @@ -0,0 +1,5326 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, applicationGatewayName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, applicationGatewayName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, applicationGatewayName, 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 (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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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} 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, applicationGatewayName, 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['ApplicationGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, applicationGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, applicationGatewayName, 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['ApplicationGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all application gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the application gateways in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayListResult']().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); + }); +} + + +/** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, applicationGatewayName, 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.beginStart(resourceGroupName, applicationGatewayName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, applicationGatewayName, 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.beginStop(resourceGroupName, applicationGatewayName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 ApplicationGatewayBackendHealth} 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 _backendHealth(resourceGroupName, applicationGatewayName, 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.beginBackendHealth(resourceGroupName, applicationGatewayName, 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['ApplicationGatewayBackendHealth']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all available web application firewall rule sets. + * + * @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 + * ApplicationGatewayAvailableWafRuleSetsResult} 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 _listAvailableWafRuleSets(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableWafRuleSets'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayAvailableWafRuleSetsResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists available Ssl options for configuring Ssl policy. + * + * @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 ApplicationGatewayAvailableSslOptions} 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 _listAvailableSslOptions(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayAvailableSslOptions']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 + * ApplicationGatewayAvailableSslPredefinedPolicies} 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 _listAvailableSslPredefinedPolicies(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayAvailableSslPredefinedPolicies']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets Ssl predefined policy with the specified policy name. + * + * @param {string} predefinedPolicyName Name of Ssl predefined policy. + * + * @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 ApplicationGatewaySslPredefinedPolicy} 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 _getSslPredefinedPolicy(predefinedPolicyName, 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (predefinedPolicyName === null || predefinedPolicyName === undefined || typeof predefinedPolicyName.valueOf() !== 'string') { + throw new Error('predefinedPolicyName cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGatewayAvailableSslOptions/default/predefinedPolicies/{predefinedPolicyName}'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + requestUrl = requestUrl.replace('{predefinedPolicyName}', encodeURIComponent(predefinedPolicyName)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewaySslPredefinedPolicy']().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 application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, applicationGatewayName, 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 (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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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} 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, applicationGatewayName, 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.'); + } + // 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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ApplicationGateway']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, applicationGatewayName, 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.'); + } + // 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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGateway']().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); + }); +} + +/** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, applicationGatewayName, 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 (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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, applicationGatewayName, 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 (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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 ApplicationGatewayBackendHealth} 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 _beginBackendHealth(resourceGroupName, applicationGatewayName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (applicationGatewayName === null || applicationGatewayName === undefined || typeof applicationGatewayName.valueOf() !== 'string') { + throw new Error('applicationGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/applicationGateways/{applicationGatewayName}/backendhealth'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationGatewayName}', encodeURIComponent(applicationGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + 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]; + } + } + } + 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['ApplicationGatewayBackendHealth']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all application gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the application gateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 + * ApplicationGatewayAvailableSslPredefinedPolicies} 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 _listAvailableSslPredefinedPoliciesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationGatewayAvailableSslPredefinedPolicies']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ApplicationGateways. */ +class ApplicationGateways { + /** + * Create a ApplicationGateways. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._list = _list; + this._listAll = _listAll; + this._start = _start; + this._stop = _stop; + this._backendHealth = _backendHealth; + this._listAvailableWafRuleSets = _listAvailableWafRuleSets; + this._listAvailableSslOptions = _listAvailableSslOptions; + this._listAvailableSslPredefinedPolicies = _listAvailableSslPredefinedPolicies; + this._getSslPredefinedPolicy = _getSslPredefinedPolicy; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginStart = _beginStart; + this._beginStop = _beginStop; + this._beginBackendHealth = _beginBackendHealth; + this._listNext = _listNext; + this._listAllNext = _listAllNext; + this._listAvailableSslPredefinedPoliciesNext = _listAvailableSslPredefinedPoliciesNext; + } + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, applicationGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Gets the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + getWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {ApplicationGateway} - 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, applicationGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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, applicationGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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 {ApplicationGateway} - 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, applicationGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGateway} - 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Lists all application gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all application gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGatewayListResult} - 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 ApplicationGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all the application gateways in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the application gateways in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGatewayListResult} - 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 ApplicationGatewayListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + startWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, applicationGatewayName, 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._start(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + stopWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, applicationGatewayName, 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._stop(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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. + */ + backendHealthWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._backendHealth(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 {ApplicationGatewayBackendHealth} - 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 ApplicationGatewayBackendHealth} 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. + */ + backendHealth(resourceGroupName, applicationGatewayName, 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._backendHealth(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._backendHealth(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Lists all available web application firewall rule sets. + * + * @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. + */ + listAvailableWafRuleSetsWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableWafRuleSets(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all available web application firewall rule sets. + * + * @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 {ApplicationGatewayAvailableWafRuleSetsResult} - 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 + * ApplicationGatewayAvailableWafRuleSetsResult} 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. + */ + listAvailableWafRuleSets(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._listAvailableWafRuleSets(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableWafRuleSets(options, optionalCallback); + } + } + + /** + * Lists available Ssl options for configuring Ssl policy. + * + * @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. + */ + listAvailableSslOptionsWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSslOptions(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists available Ssl options for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslOptions} - 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 ApplicationGatewayAvailableSslOptions} 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. + */ + listAvailableSslOptions(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._listAvailableSslOptions(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSslOptions(options, optionalCallback); + } + } + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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. + */ + listAvailableSslPredefinedPoliciesWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSslPredefinedPolicies(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslPredefinedPolicies} - 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 + * ApplicationGatewayAvailableSslPredefinedPolicies} 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. + */ + listAvailableSslPredefinedPolicies(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._listAvailableSslPredefinedPolicies(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSslPredefinedPolicies(options, optionalCallback); + } + } + + /** + * Gets Ssl predefined policy with the specified policy name. + * + * @param {string} predefinedPolicyName Name of Ssl predefined policy. + * + * @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. + */ + getSslPredefinedPolicyWithHttpOperationResponse(predefinedPolicyName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getSslPredefinedPolicy(predefinedPolicyName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets Ssl predefined policy with the specified policy name. + * + * @param {string} predefinedPolicyName Name of Ssl predefined policy. + * + * @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 {ApplicationGatewaySslPredefinedPolicy} - 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 ApplicationGatewaySslPredefinedPolicy} 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. + */ + getSslPredefinedPolicy(predefinedPolicyName, 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._getSslPredefinedPolicy(predefinedPolicyName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSslPredefinedPolicy(predefinedPolicyName, options, optionalCallback); + } + } + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, applicationGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, applicationGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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 {ApplicationGateway} - 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, applicationGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGateway} - 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 ApplicationGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, applicationGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, applicationGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginStartWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, applicationGatewayName, 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._beginStart(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginStopWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, applicationGatewayName, 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._beginStop(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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. + */ + beginBackendHealthWithHttpOperationResponse(resourceGroupName, applicationGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginBackendHealth(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 {ApplicationGatewayBackendHealth} - 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 ApplicationGatewayBackendHealth} 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. + */ + beginBackendHealth(resourceGroupName, applicationGatewayName, 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._beginBackendHealth(resourceGroupName, applicationGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginBackendHealth(resourceGroupName, applicationGatewayName, options, optionalCallback); + } + } + + /** + * Lists all application gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all application gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGatewayListResult} - 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 ApplicationGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the application gateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the application gateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationGatewayListResult} - 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 ApplicationGatewayListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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. + */ + listAvailableSslPredefinedPoliciesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableSslPredefinedPoliciesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslPredefinedPolicies} - 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 + * ApplicationGatewayAvailableSslPredefinedPolicies} 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. + */ + listAvailableSslPredefinedPoliciesNext(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._listAvailableSslPredefinedPoliciesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableSslPredefinedPoliciesNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApplicationGateways; diff --git a/lib/services/networkManagement2/lib/lib/operations/applicationSecurityGroups.js b/lib/services/networkManagement2/lib/lib/operations/applicationSecurityGroups.js new file mode 100644 index 0000000000..e72d672519 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/applicationSecurityGroups.js @@ -0,0 +1,1995 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, applicationSecurityGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets information about the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, applicationSecurityGroupName, 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 (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 (applicationSecurityGroupName === null || applicationSecurityGroupName === undefined || typeof applicationSecurityGroupName.valueOf() !== 'string') { + throw new Error('applicationSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationSecurityGroupName}', encodeURIComponent(applicationSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, 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['ApplicationSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all application security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the application security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroupListResult']().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 application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, 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 (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 (applicationSecurityGroupName === null || applicationSecurityGroupName === undefined || typeof applicationSecurityGroupName.valueOf() !== 'string') { + throw new Error('applicationSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationSecurityGroupName}', encodeURIComponent(applicationSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, 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.'); + } + // 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 (applicationSecurityGroupName === null || applicationSecurityGroupName === undefined || typeof applicationSecurityGroupName.valueOf() !== 'string') { + throw new Error('applicationSecurityGroupName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{applicationSecurityGroupName}', encodeURIComponent(applicationSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ApplicationSecurityGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroup']().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); + }); +} + +/** + * Gets all application security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the application security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ApplicationSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ApplicationSecurityGroups. */ +class ApplicationSecurityGroups { + /** + * Create a ApplicationSecurityGroups. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._listAll = _listAll; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + } + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, applicationSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, applicationSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, applicationSecurityGroupName, options, optionalCallback); + } + } + + /** + * Gets information about the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, applicationSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationSecurityGroup} - 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 ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, applicationSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, applicationSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @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, applicationSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applicationSecurityGroupName, 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 an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @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 {ApplicationSecurityGroup} - 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 ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Gets all application security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all application security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationSecurityGroupListResult} - 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 ApplicationSecurityGroupListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationSecurityGroupListResult} - 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 ApplicationSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, applicationSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, applicationSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, applicationSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, 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 an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @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 {ApplicationSecurityGroup} - 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 ApplicationSecurityGroup} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, applicationSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Gets all application security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all application security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationSecurityGroupListResult} - 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 ApplicationSecurityGroupListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ApplicationSecurityGroupListResult} - 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 ApplicationSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ApplicationSecurityGroups; diff --git a/lib/services/networkManagement2/lib/lib/operations/availableEndpointServices.js b/lib/services/networkManagement2/lib/lib/operations/availableEndpointServices.js new file mode 100644 index 0000000000..e4a6dec6fd --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/availableEndpointServices.js @@ -0,0 +1,467 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List what values of endpoint services are available for use. + * + * @param {string} location The location to check available endpoint services. + * + * @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 EndpointServicesListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(location, 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 (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices'; + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EndpointServicesListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List what values of endpoint services are available for use. + * + * @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 EndpointServicesListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['EndpointServicesListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a AvailableEndpointServices. */ +class AvailableEndpointServices { + /** + * Create a AvailableEndpointServices. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * List what values of endpoint services are available for use. + * + * @param {string} location The location to check available endpoint services. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List what values of endpoint services are available for use. + * + * @param {string} location The location to check available endpoint services. + * + * @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 {EndpointServicesListResult} - 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 EndpointServicesListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(location, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(location, options, optionalCallback); + } + } + + /** + * List what values of endpoint services are available for use. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List what values of endpoint services are available for use. + * + * @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 {EndpointServicesListResult} - 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 EndpointServicesListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = AvailableEndpointServices; diff --git a/lib/services/networkManagement2/lib/lib/operations/bgpServiceCommunities.js b/lib/services/networkManagement2/lib/lib/operations/bgpServiceCommunities.js new file mode 100644 index 0000000000..444d0a15e7 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/bgpServiceCommunities.js @@ -0,0 +1,457 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the available bgp service communities. + * + * @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 BgpServiceCommunityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BgpServiceCommunityListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the available bgp service communities. + * + * @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 BgpServiceCommunityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BgpServiceCommunityListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a BgpServiceCommunities. */ +class BgpServiceCommunities { + /** + * Create a BgpServiceCommunities. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Gets all the available bgp service communities. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the available bgp service communities. + * + * @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 {BgpServiceCommunityListResult} - 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 BgpServiceCommunityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets all the available bgp service communities. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the available bgp service communities. + * + * @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 {BgpServiceCommunityListResult} - 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 BgpServiceCommunityListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = BgpServiceCommunities; diff --git a/lib/services/networkManagement2/lib/lib/operations/connectionMonitors.js b/lib/services/networkManagement2/lib/lib/operations/connectionMonitors.js new file mode 100644 index 0000000000..709e8f1564 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/connectionMonitors.js @@ -0,0 +1,2760 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, 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['ConnectionMonitorResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a connection monitor by name. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkWatcherName, connectionMonitorName, 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 (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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionMonitorResult']().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 connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, networkWatcherName, connectionMonitorName, 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.beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _start(resourceGroupName, networkWatcherName, connectionMonitorName, 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.beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 ConnectionMonitorQueryResult} 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 _query(resourceGroupName, networkWatcherName, connectionMonitorName, 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.beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, 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['ConnectionMonitorQueryResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all connection monitors for the specified Network Watcher. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkWatcherName, 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 (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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionMonitorListResult']().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); + }); +} + +/** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, 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.'); + } + // 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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ConnectionMonitor']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionMonitorResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionMonitorResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, 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 (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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, 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 (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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/stop'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, 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 (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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/start'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 ConnectionMonitorQueryResult} 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 _beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, 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 (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 (connectionMonitorName === null || connectionMonitorName === undefined || typeof connectionMonitorName.valueOf() !== 'string') { + throw new Error('connectionMonitorName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectionMonitors/{connectionMonitorName}/query'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{connectionMonitorName}', encodeURIComponent(connectionMonitorName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ConnectionMonitorQueryResult']().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['ConnectionMonitorQueryResult']().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 ConnectionMonitors. */ +class ConnectionMonitors { + /** + * Create a ConnectionMonitors. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._createOrUpdate = _createOrUpdate; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._stop = _stop; + this._start = _start; + this._query = _query; + this._list = _list; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginStop = _beginStop; + this._beginStart = _beginStart; + this._beginQuery = _beginQuery; + } + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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, connectionMonitorName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 {ConnectionMonitorResult} - 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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, optionalCallback); + } + } + + /** + * Gets a connection monitor by name. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a connection monitor by name. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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 {ConnectionMonitorResult} - 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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, networkWatcherName, connectionMonitorName, 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._stop(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + startWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._start(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName, networkWatcherName, connectionMonitorName, 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._start(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._start(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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. + */ + queryWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._query(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 {ConnectionMonitorQueryResult} - 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 ConnectionMonitorQueryResult} 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. + */ + query(resourceGroupName, networkWatcherName, connectionMonitorName, 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._query(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._query(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Lists all connection monitors for the specified Network Watcher. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkWatcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all connection monitors for the specified Network Watcher. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ConnectionMonitorListResult} - 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 ConnectionMonitorListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkWatcherName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkWatcherName, options, optionalCallback); + } + } + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 {ConnectionMonitorResult} - 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 ConnectionMonitorResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, networkWatcherName, connectionMonitorName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + beginStopWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, 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._beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + beginStartWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, 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._beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStart(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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. + */ + beginQueryWithHttpOperationResponse(resourceGroupName, networkWatcherName, connectionMonitorName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 {ConnectionMonitorQueryResult} - 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 ConnectionMonitorQueryResult} 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. + */ + beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, 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._beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginQuery(resourceGroupName, networkWatcherName, connectionMonitorName, options, optionalCallback); + } + } + +} + +module.exports = ConnectionMonitors; diff --git a/lib/services/networkManagement2/lib/lib/operations/ddosProtectionPlans.js b/lib/services/networkManagement2/lib/lib/operations/ddosProtectionPlans.js new file mode 100644 index 0000000000..aa2e109e9d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/ddosProtectionPlans.js @@ -0,0 +1,1974 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, ddosProtectionPlanName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets information about the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @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 DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, ddosProtectionPlanName, 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 (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 (ddosProtectionPlanName === null || ddosProtectionPlanName === undefined || typeof ddosProtectionPlanName.valueOf() !== 'string') { + throw new Error('ddosProtectionPlanName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ddosProtectionPlanName}', encodeURIComponent(ddosProtectionPlanName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlan']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, 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['DdosProtectionPlan']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all DDoS protection plans in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/ddosProtectionPlans'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlanListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlanListResult']().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 DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, 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 (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 (ddosProtectionPlanName === null || ddosProtectionPlanName === undefined || typeof ddosProtectionPlanName.valueOf() !== 'string') { + throw new Error('ddosProtectionPlanName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ddosProtectionPlanName}', encodeURIComponent(ddosProtectionPlanName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, 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.'); + } + // 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 (ddosProtectionPlanName === null || ddosProtectionPlanName === undefined || typeof ddosProtectionPlanName.valueOf() !== 'string') { + throw new Error('ddosProtectionPlanName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/ddosProtectionPlans/{ddosProtectionPlanName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{ddosProtectionPlanName}', encodeURIComponent(ddosProtectionPlanName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['DdosProtectionPlan']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlan']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlan']().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); + }); +} + +/** + * Gets all DDoS protection plans in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlanListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['DdosProtectionPlanListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a DdosProtectionPlans. */ +class DdosProtectionPlans { + /** + * Create a DdosProtectionPlans. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, ddosProtectionPlanName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, ddosProtectionPlanName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, ddosProtectionPlanName, options, optionalCallback); + } + } + + /** + * Gets information about the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, ddosProtectionPlanName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @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 {DdosProtectionPlan} - 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 DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, ddosProtectionPlanName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, ddosProtectionPlanName, options, optionalCallback); + } + } + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @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, ddosProtectionPlanName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, ddosProtectionPlanName, 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 DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @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 {DdosProtectionPlan} - 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 DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, optionalCallback); + } + } + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DdosProtectionPlanListResult} - 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 DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DdosProtectionPlanListResult} - 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 DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, ddosProtectionPlanName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, ddosProtectionPlanName, options, optionalCallback); + } + } + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, ddosProtectionPlanName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, 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 DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @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 {DdosProtectionPlan} - 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 DdosProtectionPlan} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, ddosProtectionPlanName, parameters, options, optionalCallback); + } + } + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DdosProtectionPlanListResult} - 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 DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {DdosProtectionPlanListResult} - 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 DdosProtectionPlanListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DdosProtectionPlans; diff --git a/lib/services/networkManagement2/lib/lib/operations/defaultSecurityRules.js b/lib/services/networkManagement2/lib/lib/operations/defaultSecurityRules.js new file mode 100644 index 0000000000..19435f09e3 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/defaultSecurityRules.js @@ -0,0 +1,728 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all default security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkSecurityGroupName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRuleListResult']().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); + }); +} + +/** + * Get the specified default network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} defaultSecurityRuleName The name of the default security + * rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (defaultSecurityRuleName === null || defaultSecurityRuleName === undefined || typeof defaultSecurityRuleName.valueOf() !== 'string') { + throw new Error('defaultSecurityRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{defaultSecurityRuleName}', encodeURIComponent(defaultSecurityRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all default security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a DefaultSecurityRules. */ +class DefaultSecurityRules { + /** + * Create a DefaultSecurityRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all default security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all default security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRuleListResult} - 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 SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkSecurityGroupName, options, optionalCallback); + } + } + + /** + * Get the specified default network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} defaultSecurityRuleName The name of the default security + * rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified default network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} defaultSecurityRuleName The name of the default security + * rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRule} - 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName, options, optionalCallback); + } + } + + /** + * Gets all default security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all default security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRuleListResult} - 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 SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = DefaultSecurityRules; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitAuthorizations.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitAuthorizations.js new file mode 100644 index 0000000000..52d2037c8b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitAuthorizations.js @@ -0,0 +1,1676 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, circuitName, authorizationName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, circuitName, authorizationName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, circuitName, authorizationName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (authorizationName === null || authorizationName === undefined || typeof authorizationName.valueOf() !== 'string') { + throw new Error('authorizationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{authorizationName}', encodeURIComponent(authorizationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitAuthorization']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, 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['ExpressRouteCircuitAuthorization']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all authorizations in an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @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 AuthorizationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, circuitName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AuthorizationListResult']().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 authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, circuitName, authorizationName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (authorizationName === null || authorizationName === undefined || typeof authorizationName.valueOf() !== 'string') { + throw new Error('authorizationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{authorizationName}', encodeURIComponent(authorizationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (authorizationName === null || authorizationName === undefined || typeof authorizationName.valueOf() !== 'string') { + throw new Error('authorizationName cannot be null or undefined and it must be of type string.'); + } + if (authorizationParameters === null || authorizationParameters === undefined) { + throw new Error('authorizationParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{authorizationName}', encodeURIComponent(authorizationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (authorizationParameters !== null && authorizationParameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCircuitAuthorization']().mapper(); + requestModel = client.serialize(requestModelMapper, authorizationParameters, 'authorizationParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(authorizationParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitAuthorization']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitAuthorization']().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); + }); +} + +/** + * Gets all authorizations in an express route circuit. + * + * @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 AuthorizationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['AuthorizationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteCircuitAuthorizations. */ +class ExpressRouteCircuitAuthorizations { + /** + * Create a ExpressRouteCircuitAuthorizations. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, authorizationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, circuitName, authorizationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, circuitName, authorizationName, options, optionalCallback); + } + } + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, circuitName, authorizationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @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 {ExpressRouteCircuitAuthorization} - 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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, circuitName, authorizationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, circuitName, authorizationName, options, optionalCallback); + } + } + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, authorizationName, authorizationParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, 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 an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 {ExpressRouteCircuitAuthorization} - 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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, optionalCallback); + } + } + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @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 {AuthorizationListResult} - 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 AuthorizationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, circuitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, authorizationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, circuitName, authorizationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, authorizationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, circuitName, authorizationName, options, optionalCallback); + } + } + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, authorizationName, authorizationParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, 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 an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 {ExpressRouteCircuitAuthorization} - 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 ExpressRouteCircuitAuthorization} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, circuitName, authorizationName, authorizationParameters, options, optionalCallback); + } + } + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all authorizations in an express route circuit. + * + * @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 {AuthorizationListResult} - 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 AuthorizationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCircuitAuthorizations; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitConnections.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitConnections.js new file mode 100644 index 0000000000..996630c055 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitConnections.js @@ -0,0 +1,1348 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, circuitName, peeringName, connectionName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, 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['ExpressRouteCircuitConnection']().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 Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (connectionName === null || connectionName === undefined || typeof connectionName.valueOf() !== 'string') { + throw new Error('connectionName cannot be null or undefined and it must be of type string.'); + } + if (expressRouteCircuitConnectionParameters === null || expressRouteCircuitConnectionParameters === undefined) { + throw new Error('expressRouteCircuitConnectionParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/connections/{connectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{connectionName}', encodeURIComponent(connectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (expressRouteCircuitConnectionParameters !== null && expressRouteCircuitConnectionParameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCircuitConnection']().mapper(); + requestModel = client.serialize(requestModelMapper, expressRouteCircuitConnectionParameters, 'expressRouteCircuitConnectionParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(expressRouteCircuitConnectionParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitConnection']().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 ExpressRouteCircuitConnections. */ +class ExpressRouteCircuitConnections { + /** + * Create a ExpressRouteCircuitConnections. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + } + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback); + } + } + + /** + * Gets the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuitConnection} - 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 ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback); + } + } + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, 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 Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 {ExpressRouteCircuitConnection} - 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 ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, optionalCallback); + } + } + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, connectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, connectionName, options, optionalCallback); + } + } + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, 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 Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 {ExpressRouteCircuitConnection} - 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 ExpressRouteCircuitConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCircuitConnections; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitPeerings.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitPeerings.js new file mode 100644 index 0000000000..1647d432da --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuitPeerings.js @@ -0,0 +1,2330 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, circuitName, peeringName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, circuitName, peeringName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, circuitName, peeringName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, 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['ExpressRouteCircuitPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all peerings in a specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, circuitName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitPeeringListResult']().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 peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, circuitName, peeringName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (peeringParameters === null || peeringParameters === undefined) { + throw new Error('peeringParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (peeringParameters !== null && peeringParameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCircuitPeering']().mapper(); + requestModel = client.serialize(requestModelMapper, peeringParameters, 'peeringParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(peeringParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitPeering']().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); + }); +} + +/** + * Gets all peerings in a specified express route circuit. + * + * @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 ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitPeeringListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteCircuitPeerings. */ +class ExpressRouteCircuitPeerings { + /** + * Create a ExpressRouteCircuitPeerings. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, circuitName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, circuitName, peeringName, options, optionalCallback); + } + } + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCircuitPeering} - 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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, circuitName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, circuitName, peeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, peeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, 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 peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCircuitPeering} - 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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, optionalCallback); + } + } + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 {ExpressRouteCircuitPeeringListResult} - 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 ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, circuitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, circuitName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, circuitName, peeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, peeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, 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 peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCircuitPeering} - 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 ExpressRouteCircuitPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, circuitName, peeringName, peeringParameters, options, optionalCallback); + } + } + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all peerings in a specified express route circuit. + * + * @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 {ExpressRouteCircuitPeeringListResult} - 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 ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCircuitPeerings; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuits.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuits.js new file mode 100644 index 0000000000..2ec0768228 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCircuits.js @@ -0,0 +1,4511 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, circuitName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, circuitName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets information about the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of express route circuit. + * + * @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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, circuitName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, circuitName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, circuitName, 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['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, circuitName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, circuitName, 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['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsArpTableListResult} 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 _listArpTable(resourceGroupName, circuitName, peeringName, devicePath, 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.beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, 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['ExpressRouteCircuitsArpTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsRoutesTableListResult} + * 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 _listRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, 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.beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, 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['ExpressRouteCircuitsRoutesTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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 _listRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, 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.beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, 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['ExpressRouteCircuitsRoutesTableSummaryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all the stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 ExpressRouteCircuitStats} 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 _getStats(resourceGroupName, circuitName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitStats']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 ExpressRouteCircuitStats} 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 _getPeeringStats(resourceGroupName, circuitName, peeringName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitStats']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the express route circuits in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the express route circuits in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitListResult']().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 express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, circuitName, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, circuitName, 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.'); + } + // 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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCircuit']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, circuitName, 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.'); + } + // 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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuit']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsArpTableListResult} 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 _beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCircuitsArpTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsRoutesTableListResult} + * 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 _beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCircuitsRoutesTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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 _beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, 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 (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 (circuitName === null || circuitName === undefined || typeof circuitName.valueOf() !== 'string') { + throw new Error('circuitName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{circuitName}', encodeURIComponent(circuitName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCircuitsRoutesTableSummaryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the express route circuits in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the express route circuits in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCircuitListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteCircuits. */ +class ExpressRouteCircuits { + /** + * Create a ExpressRouteCircuits. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listArpTable = _listArpTable; + this._listRoutesTable = _listRoutesTable; + this._listRoutesTableSummary = _listRoutesTableSummary; + this._getStats = _getStats; + this._getPeeringStats = _getPeeringStats; + this._list = _list; + this._listAll = _listAll; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginListArpTable = _beginListArpTable; + this._beginListRoutesTable = _beginListRoutesTable; + this._beginListRoutesTableSummary = _beginListRoutesTableSummary; + this._listNext = _listNext; + this._listAllNext = _listAllNext; + } + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, circuitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Gets information about the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of express route circuit. + * + * @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 {ExpressRouteCircuit} - 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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, circuitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @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, circuitName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, 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 an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @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 {ExpressRouteCircuit} - 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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, circuitName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, circuitName, parameters, options, optionalCallback); + } + } + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, circuitName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuit} - 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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, circuitName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, circuitName, parameters, options, optionalCallback); + } + } + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listArpTableWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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 ExpressRouteCircuitsArpTableListResult} 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. + */ + listArpTable(resourceGroupName, circuitName, peeringName, devicePath, 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._listArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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 ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + listRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, 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._listRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableSummaryWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableSummaryListResult} - 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 + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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. + */ + listRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, 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._listRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets all the stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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. + */ + getStatsWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getStats(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 {ExpressRouteCircuitStats} - 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 ExpressRouteCircuitStats} 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. + */ + getStats(resourceGroupName, circuitName, 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._getStats(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStats(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Gets all stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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. + */ + getPeeringStatsWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getPeeringStats(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCircuitStats} - 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 ExpressRouteCircuitStats} 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. + */ + getPeeringStats(resourceGroupName, circuitName, peeringName, 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._getPeeringStats(resourceGroupName, circuitName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getPeeringStats(resourceGroupName, circuitName, peeringName, options, optionalCallback); + } + } + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuitListResult} - 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 ExpressRouteCircuitListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all the express route circuits in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the express route circuits in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuitListResult} - 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 ExpressRouteCircuitListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, circuitName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, circuitName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, circuitName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, circuitName, options, optionalCallback); + } + } + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, circuitName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, 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 an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @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 {ExpressRouteCircuit} - 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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, circuitName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, circuitName, parameters, options, optionalCallback); + } + } + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, circuitName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuit} - 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 ExpressRouteCircuit} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, circuitName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, circuitName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, circuitName, parameters, options, optionalCallback); + } + } + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListArpTableWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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 ExpressRouteCircuitsArpTableListResult} 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. + */ + beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, 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._beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListArpTable(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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 ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, 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._beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListRoutesTable(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableSummaryWithHttpOperationResponse(resourceGroupName, circuitName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableSummaryListResult} - 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 + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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. + */ + beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, 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._beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListRoutesTableSummary(resourceGroupName, circuitName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuitListResult} - 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 ExpressRouteCircuitListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the express route circuits in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the express route circuits in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCircuitListResult} - 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 ExpressRouteCircuitListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCircuits; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnectionPeerings.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnectionPeerings.js new file mode 100644 index 0000000000..3a8e0f4b02 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnectionPeerings.js @@ -0,0 +1,2150 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @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 ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, crossConnectionName, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionPeeringList']().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 peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, crossConnectionName, peeringName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified peering for the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, crossConnectionName, peeringName, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, 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['ExpressRouteCrossConnectionPeering']().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 peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (peeringParameters === null || peeringParameters === undefined) { + throw new Error('peeringParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (peeringParameters !== null && peeringParameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCrossConnectionPeering']().mapper(); + requestModel = client.serialize(requestModelMapper, peeringParameters, 'peeringParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(peeringParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionPeering']().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); + }); +} + +/** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @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 ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionPeeringList']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteCrossConnectionPeerings. */ +class ExpressRouteCrossConnectionPeerings { + /** + * Create a ExpressRouteCrossConnectionPeerings. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, crossConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, crossConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @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 {ExpressRouteCrossConnectionPeeringList} - 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 ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, crossConnectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, crossConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, crossConnectionName, options, optionalCallback); + } + } + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback); + } + } + + /** + * Gets the specified peering for the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified peering for the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCrossConnectionPeering} - 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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, 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 peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCrossConnectionPeering} - 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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, optionalCallback); + } + } + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, crossConnectionName, peeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, 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 peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCrossConnectionPeering} - 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 ExpressRouteCrossConnectionPeering} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, peeringName, peeringParameters, options, optionalCallback); + } + } + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @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 {ExpressRouteCrossConnectionPeeringList} - 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 ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCrossConnectionPeerings; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnections.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnections.js new file mode 100644 index 0000000000..aa4f1a8d0d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteCrossConnections.js @@ -0,0 +1,3466 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets details about the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group (peering + * location of the circuit). + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection (service key of the circuit). + * + * @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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, crossConnectionName, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, crossConnectionName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, crossConnectionName, 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['ExpressRouteCrossConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, 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['ExpressRouteCrossConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 ExpressRouteCircuitsArpTableListResult} 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 _listArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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.beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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['ExpressRouteCircuitsArpTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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 _listRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, 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.beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, 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['ExpressRouteCrossConnectionsRoutesTableSummaryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsRoutesTableListResult} + * 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 _listRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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.beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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['ExpressRouteCircuitsRoutesTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, crossConnectionName, 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.'); + } + // 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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ExpressRouteCrossConnection']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (crossConnectionParameters === null || crossConnectionParameters === undefined) { + throw new Error('crossConnectionParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (crossConnectionParameters !== null && crossConnectionParameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, crossConnectionParameters, 'crossConnectionParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(crossConnectionParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 ExpressRouteCircuitsArpTableListResult} 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 _beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCircuitsArpTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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 _beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCrossConnectionsRoutesTableSummaryListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 ExpressRouteCircuitsRoutesTableListResult} + * 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 _beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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 (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 (crossConnectionName === null || crossConnectionName === undefined || typeof crossConnectionName.valueOf() !== 'string') { + throw new Error('crossConnectionName cannot be null or undefined and it must be of type string.'); + } + if (peeringName === null || peeringName === undefined || typeof peeringName.valueOf() !== 'string') { + throw new Error('peeringName cannot be null or undefined and it must be of type string.'); + } + if (devicePath === null || devicePath === undefined || typeof devicePath.valueOf() !== 'string') { + throw new Error('devicePath cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{crossConnectionName}', encodeURIComponent(crossConnectionName)); + requestUrl = requestUrl.replace('{peeringName}', encodeURIComponent(peeringName)); + requestUrl = requestUrl.replace('{devicePath}', encodeURIComponent(devicePath)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['ExpressRouteCircuitsRoutesTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteCrossConnectionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteCrossConnections. */ +class ExpressRouteCrossConnections { + /** + * Create a ExpressRouteCrossConnections. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listByResourceGroup = _listByResourceGroup; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listArpTable = _listArpTable; + this._listRoutesTableSummary = _listRoutesTableSummary; + this._listRoutesTable = _listRoutesTable; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginListArpTable = _beginListArpTable; + this._beginListRoutesTableSummary = _beginListRoutesTableSummary; + this._beginListRoutesTable = _beginListRoutesTable; + this._listNext = _listNext; + this._listByResourceGroupNext = _listByResourceGroupNext; + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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 ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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 ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets details about the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group (peering + * location of the circuit). + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection (service key of the circuit). + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, crossConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, crossConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets details about the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group (peering + * location of the circuit). + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection (service key of the circuit). + * + * @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 {ExpressRouteCrossConnection} - 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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, crossConnectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, crossConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, crossConnectionName, options, optionalCallback); + } + } + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @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, crossConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, crossConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @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 {ExpressRouteCrossConnection} - 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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, crossConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, crossConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, crossConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, crossConnectionName, crossConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.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 {ExpressRouteCrossConnection} - 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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, optionalCallback); + } + } + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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. + */ + listArpTableWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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 ExpressRouteCircuitsArpTableListResult} 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. + */ + listArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._listArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableSummaryWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} - 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 + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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. + */ + listRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._listRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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 ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + listRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._listRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, crossConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @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 {ExpressRouteCrossConnection} - 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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, crossConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, crossConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, crossConnectionName, crossConnectionParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.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 {ExpressRouteCrossConnection} - 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 ExpressRouteCrossConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, crossConnectionName, crossConnectionParameters, options, optionalCallback); + } + } + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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. + */ + beginListArpTableWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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 ExpressRouteCircuitsArpTableListResult} 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. + */ + beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListArpTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableSummaryWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} - 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 + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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. + */ + beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListRoutesTableSummary(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableWithHttpOperationResponse(resourceGroupName, crossConnectionName, peeringName, devicePath, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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 ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, 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._beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListRoutesTable(resourceGroupName, crossConnectionName, peeringName, devicePath, options, optionalCallback); + } + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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 ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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 ExpressRouteCrossConnectionListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteCrossConnections; diff --git a/lib/services/networkManagement2/lib/lib/operations/expressRouteServiceProviders.js b/lib/services/networkManagement2/lib/lib/operations/expressRouteServiceProviders.js new file mode 100644 index 0000000000..c0c647acd9 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/expressRouteServiceProviders.js @@ -0,0 +1,457 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the available express route service providers. + * + * @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 ExpressRouteServiceProviderListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteServiceProviderListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the available express route service providers. + * + * @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 ExpressRouteServiceProviderListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ExpressRouteServiceProviderListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a ExpressRouteServiceProviders. */ +class ExpressRouteServiceProviders { + /** + * Create a ExpressRouteServiceProviders. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Gets all the available express route service providers. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the available express route service providers. + * + * @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 {ExpressRouteServiceProviderListResult} - 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 ExpressRouteServiceProviderListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Gets all the available express route service providers. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the available express route service providers. + * + * @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 {ExpressRouteServiceProviderListResult} - 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 ExpressRouteServiceProviderListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = ExpressRouteServiceProviders; diff --git a/lib/services/networkManagement2/lib/lib/operations/inboundNatRules.js b/lib/services/networkManagement2/lib/lib/operations/inboundNatRules.js new file mode 100644 index 0000000000..df67087433 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/inboundNatRules.js @@ -0,0 +1,1815 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InboundNatRuleListResult']().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 load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, inboundNatRuleName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (inboundNatRuleName === null || inboundNatRuleName === undefined || typeof inboundNatRuleName.valueOf() !== 'string') { + throw new Error('inboundNatRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{inboundNatRuleName}', encodeURIComponent(inboundNatRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InboundNatRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, 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['InboundNatRule']().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 load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (inboundNatRuleName === null || inboundNatRuleName === undefined || typeof inboundNatRuleName.valueOf() !== 'string') { + throw new Error('inboundNatRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{inboundNatRuleName}', encodeURIComponent(inboundNatRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (inboundNatRuleName === null || inboundNatRuleName === undefined || typeof inboundNatRuleName.valueOf() !== 'string') { + throw new Error('inboundNatRuleName cannot be null or undefined and it must be of type string.'); + } + if (inboundNatRuleParameters === null || inboundNatRuleParameters === undefined) { + throw new Error('inboundNatRuleParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{inboundNatRuleName}', encodeURIComponent(inboundNatRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (inboundNatRuleParameters !== null && inboundNatRuleParameters !== undefined) { + let requestModelMapper = new client.models['InboundNatRule']().mapper(); + requestModel = client.serialize(requestModelMapper, inboundNatRuleParameters, 'inboundNatRuleParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(inboundNatRuleParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InboundNatRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InboundNatRule']().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); + }); +} + +/** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['InboundNatRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a InboundNatRules. */ +class InboundNatRules { + /** + * Create a InboundNatRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InboundNatRuleListResult} - 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 InboundNatRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, loadBalancerName, inboundNatRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback); + } + } + + /** + * Gets the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, inboundNatRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {InboundNatRule} - 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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback); + } + } + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, 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 load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 {InboundNatRule} - 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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, optionalCallback); + } + } + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, loadBalancerName, inboundNatRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, loadBalancerName, inboundNatRuleName, options, optionalCallback); + } + } + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, 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 load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 {InboundNatRule} - 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 InboundNatRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options, optionalCallback); + } + } + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {InboundNatRuleListResult} - 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 InboundNatRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = InboundNatRules; diff --git a/lib/services/networkManagement2/lib/lib/operations/index.d.ts b/lib/services/networkManagement2/lib/lib/operations/index.d.ts new file mode 100644 index 0000000000..296df33692 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/index.d.ts @@ -0,0 +1,30651 @@ +/* + * 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. +*/ + +import { ServiceClientOptions, RequestOptions, ServiceCallback, HttpOperationResponse } from 'ms-rest'; +import * as models from '../models'; + + +/** + * @class + * ApplicationGateways + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ApplicationGateways { + + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + getWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {ApplicationGateway} - 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. + * + * {ApplicationGateway} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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 {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 {ApplicationGateway} - 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. + * + * {ApplicationGateway} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGateway} - 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. + * + * {ApplicationGateway} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all application gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all application gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGatewayListResult} - 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. + * + * {ApplicationGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the application gateways in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the application gateways in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGatewayListResult} - 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. + * + * {ApplicationGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + startWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + stopWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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. + */ + backendHealthWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 {ApplicationGatewayBackendHealth} - 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. + * + * {ApplicationGatewayBackendHealth} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayBackendHealth} 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. + */ + backendHealth(resourceGroupName: string, applicationGatewayName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + backendHealth(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + backendHealth(resourceGroupName: string, applicationGatewayName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all available web application firewall rule sets. + * + * @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. + */ + listAvailableWafRuleSetsWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all available web application firewall rule sets. + * + * @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 {ApplicationGatewayAvailableWafRuleSetsResult} - 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. + * + * {ApplicationGatewayAvailableWafRuleSetsResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationGatewayAvailableWafRuleSetsResult} 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. + */ + listAvailableWafRuleSets(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableWafRuleSets(callback: ServiceCallback): void; + listAvailableWafRuleSets(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists available Ssl options for configuring Ssl policy. + * + * @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. + */ + listAvailableSslOptionsWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists available Ssl options for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslOptions} - 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. + * + * {ApplicationGatewayAvailableSslOptions} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayAvailableSslOptions} 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. + */ + listAvailableSslOptions(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSslOptions(callback: ServiceCallback): void; + listAvailableSslOptions(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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. + */ + listAvailableSslPredefinedPoliciesWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslPredefinedPolicies} - 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. + * + * {ApplicationGatewayAvailableSslPredefinedPolicies} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationGatewayAvailableSslPredefinedPolicies} 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. + */ + listAvailableSslPredefinedPolicies(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSslPredefinedPolicies(callback: ServiceCallback): void; + listAvailableSslPredefinedPolicies(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets Ssl predefined policy with the specified policy name. + * + * @param {string} predefinedPolicyName Name of Ssl predefined policy. + * + * @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. + */ + getSslPredefinedPolicyWithHttpOperationResponse(predefinedPolicyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets Ssl predefined policy with the specified policy name. + * + * @param {string} predefinedPolicyName Name of Ssl predefined policy. + * + * @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 {ApplicationGatewaySslPredefinedPolicy} - 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. + * + * {ApplicationGatewaySslPredefinedPolicy} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewaySslPredefinedPolicy} 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. + */ + getSslPredefinedPolicy(predefinedPolicyName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSslPredefinedPolicy(predefinedPolicyName: string, callback: ServiceCallback): void; + getSslPredefinedPolicy(predefinedPolicyName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to the create or update + * application gateway operation. + * + * @param {object} [parameters.sku] SKU of the application gateway resource. + * + * @param {string} [parameters.sku.name] Name of an application gateway SKU. + * Possible values include: 'Standard_Small', 'Standard_Medium', + * 'Standard_Large', 'WAF_Medium', 'WAF_Large' + * + * @param {string} [parameters.sku.tier] Tier of an application gateway. + * Possible values include: 'Standard', 'WAF' + * + * @param {number} [parameters.sku.capacity] Capacity (instance count) of an + * application gateway. + * + * @param {object} [parameters.sslPolicy] SSL policy of the application gateway + * resource. + * + * @param {array} [parameters.sslPolicy.disabledSslProtocols] Ssl protocols to + * be disabled on application gateway. + * + * @param {string} [parameters.sslPolicy.policyType] Type of Ssl Policy. + * Possible values include: 'Predefined', 'Custom' + * + * @param {string} [parameters.sslPolicy.policyName] Name of Ssl predefined + * policy. Possible values include: 'AppGwSslPolicy20150501', + * 'AppGwSslPolicy20170401', 'AppGwSslPolicy20170401S' + * + * @param {array} [parameters.sslPolicy.cipherSuites] Ssl cipher suites to be + * enabled in the specified order to application gateway. + * + * @param {string} [parameters.sslPolicy.minProtocolVersion] Minimum version of + * Ssl protocol to be supported on application gateway. Possible values + * include: 'TLSv1_0', 'TLSv1_1', 'TLSv1_2' + * + * @param {array} [parameters.gatewayIPConfigurations] Subnets of application + * the gateway resource. + * + * @param {array} [parameters.authenticationCertificates] Authentication + * certificates of the application gateway resource. + * + * @param {array} [parameters.sslCertificates] SSL certificates of the + * application gateway resource. + * + * @param {array} [parameters.frontendIPConfigurations] Frontend IP addresses + * of the application gateway resource. + * + * @param {array} [parameters.frontendPorts] Frontend ports of the application + * gateway resource. + * + * @param {array} [parameters.probes] Probes of the application gateway + * resource. + * + * @param {array} [parameters.backendAddressPools] Backend address pool of the + * application gateway resource. + * + * @param {array} [parameters.backendHttpSettingsCollection] Backend http + * settings of the application gateway resource. + * + * @param {array} [parameters.httpListeners] Http listeners of the application + * gateway resource. + * + * @param {array} [parameters.urlPathMaps] URL path map of the application + * gateway resource. + * + * @param {array} [parameters.requestRoutingRules] Request routing rules of the + * application gateway resource. + * + * @param {array} [parameters.redirectConfigurations] Redirect configurations + * of the application gateway resource. + * + * @param {object} [parameters.webApplicationFirewallConfiguration] Web + * application firewall configuration. + * + * @param {boolean} parameters.webApplicationFirewallConfiguration.enabled + * Whether the web application firewall is enabled or not. + * + * @param {string} parameters.webApplicationFirewallConfiguration.firewallMode + * Web application firewall mode. Possible values include: 'Detection', + * 'Prevention' + * + * @param {string} parameters.webApplicationFirewallConfiguration.ruleSetType + * The type of the web application firewall rule set. Possible values are: + * 'OWASP'. + * + * @param {string} + * parameters.webApplicationFirewallConfiguration.ruleSetVersion The version of + * the rule set type. + * + * @param {array} + * [parameters.webApplicationFirewallConfiguration.disabledRuleGroups] The + * disabled rule groups. + * + * @param {boolean} + * [parameters.webApplicationFirewallConfiguration.requestBodyCheck] Whether + * allow WAF to check request Body. + * + * @param {number} + * [parameters.webApplicationFirewallConfiguration.maxRequestBodySize] Maxium + * request body size for WAF. + * + * @param {boolean} [parameters.enableHttp2] Whether HTTP2 is enabled on the + * application gateway resource. + * + * @param {string} [parameters.resourceGuid] Resource GUID property of the + * application gateway resource. + * + * @param {string} [parameters.provisioningState] Provisioning state of the + * application gateway resource. Possible values are: 'Updating', 'Deleting', + * and 'Failed'. + * + * @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 {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 {ApplicationGateway} - 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. + * + * {ApplicationGateway} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, applicationGatewayName: string, parameters: models.ApplicationGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates the specified application gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} parameters Parameters supplied to update application gateway + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGateway} - 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. + * + * {ApplicationGateway} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, applicationGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts the specified application gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops the specified application gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the 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 {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, applicationGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, applicationGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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. + */ + beginBackendHealthWithHttpOperationResponse(resourceGroupName: string, applicationGatewayName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the backend health of the specified application gateway in a resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationGatewayName The name of the application gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands BackendAddressPool and + * BackendHttpSettings referenced in backend health. + * + * @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 {ApplicationGatewayBackendHealth} - 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. + * + * {ApplicationGatewayBackendHealth} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayBackendHealth} 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. + */ + beginBackendHealth(resourceGroupName: string, applicationGatewayName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginBackendHealth(resourceGroupName: string, applicationGatewayName: string, callback: ServiceCallback): void; + beginBackendHealth(resourceGroupName: string, applicationGatewayName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all application gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all application gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGatewayListResult} - 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. + * + * {ApplicationGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the application gateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the application gateways in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationGatewayListResult} - 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. + * + * {ApplicationGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationGatewayListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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. + */ + listAvailableSslPredefinedPoliciesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all SSL predefined policies for configuring Ssl policy. + * + * @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 {ApplicationGatewayAvailableSslPredefinedPolicies} - 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. + * + * {ApplicationGatewayAvailableSslPredefinedPolicies} [result] - The deserialized result object if an error did not occur. + * See {@link + * ApplicationGatewayAvailableSslPredefinedPolicies} 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. + */ + listAvailableSslPredefinedPoliciesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableSslPredefinedPoliciesNext(nextPageLink: string, callback: ServiceCallback): void; + listAvailableSslPredefinedPoliciesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ApplicationSecurityGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ApplicationSecurityGroups { + + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroup} - 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. + * + * {ApplicationSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, applicationSecurityGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, applicationSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroup} - 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. + * + * {ApplicationSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all application security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all application security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroupListResult} - 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. + * + * {ApplicationSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroupListResult} - 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. + * + * {ApplicationSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, applicationSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an application security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} applicationSecurityGroupName The name of the application + * security group. + * + * @param {object} parameters Parameters supplied to the create or update + * ApplicationSecurityGroup operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroup} - 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. + * + * {ApplicationSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroup} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, applicationSecurityGroupName: string, parameters: models.ApplicationSecurityGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all application security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all application security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroupListResult} - 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. + * + * {ApplicationSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the application security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ApplicationSecurityGroupListResult} - 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. + * + * {ApplicationSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ApplicationSecurityGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DdosProtectionPlans + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface DdosProtectionPlans { + + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @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 {DdosProtectionPlan} - 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. + * + * {DdosProtectionPlan} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlan} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, ddosProtectionPlanName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, ddosProtectionPlanName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlan} - 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. + * + * {DdosProtectionPlan} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlan} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlanListResult} - 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. + * + * {DdosProtectionPlanListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlanListResult} - 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. + * + * {DdosProtectionPlanListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, ddosProtectionPlanName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a DDoS protection plan. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} ddosProtectionPlanName The name of the DDoS protection plan. + * + * @param {object} parameters Parameters supplied to the create or update + * operation. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlan} - 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. + * + * {DdosProtectionPlan} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlan} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, ddosProtectionPlanName: string, parameters: models.DdosProtectionPlan, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all DDoS protection plans in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlanListResult} - 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. + * + * {DdosProtectionPlanListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the DDoS protection plans in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {DdosProtectionPlanListResult} - 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. + * + * {DdosProtectionPlanListResult} [result] - The deserialized result object if an error did not occur. + * See {@link DdosProtectionPlanListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * AvailableEndpointServices + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface AvailableEndpointServices { + + + /** + * List what values of endpoint services are available for use. + * + * @param {string} location The location to check available endpoint services. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List what values of endpoint services are available for use. + * + * @param {string} location The location to check available endpoint services. + * + * @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 {EndpointServicesListResult} - 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. + * + * {EndpointServicesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EndpointServicesListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(location: string, callback: ServiceCallback): void; + list(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List what values of endpoint services are available for use. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List what values of endpoint services are available for use. + * + * @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 {EndpointServicesListResult} - 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. + * + * {EndpointServicesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EndpointServicesListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCircuitAuthorizations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCircuitAuthorizations { + + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @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 {ExpressRouteCircuitAuthorization} - 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. + * + * {ExpressRouteCircuitAuthorization} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitAuthorization} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, circuitName: string, authorizationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, circuitName: string, authorizationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 {ExpressRouteCircuitAuthorization} - 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. + * + * {ExpressRouteCircuitAuthorization} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitAuthorization} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @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 {AuthorizationListResult} - 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. + * + * {AuthorizationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified authorization from the specified express route + * circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, circuitName: string, authorizationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an authorization in the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} authorizationName The name of the authorization. + * + * @param {object} authorizationParameters Parameters supplied to the create or + * update express route circuit authorization operation. + * + * @param {string} [authorizationParameters.authorizationKey] The authorization + * key. + * + * @param {string} [authorizationParameters.authorizationUseStatus] + * AuthorizationUseStatus. Possible values are: 'Available' and 'InUse'. + * Possible values include: 'Available', 'InUse' + * + * @param {string} [authorizationParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [authorizationParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [authorizationParameters.id] Resource 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 {ExpressRouteCircuitAuthorization} - 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. + * + * {ExpressRouteCircuitAuthorization} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitAuthorization} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, authorizationName: string, authorizationParameters: models.ExpressRouteCircuitAuthorization, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all authorizations in an express route circuit. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all authorizations in an express route circuit. + * + * @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 {AuthorizationListResult} - 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. + * + * {AuthorizationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link AuthorizationListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCircuitPeerings + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCircuitPeerings { + + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified authorization from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCircuitPeering} - 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. + * + * {ExpressRouteCircuitPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, circuitName: string, peeringName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, circuitName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCircuitPeering} - 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. + * + * {ExpressRouteCircuitPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 {ExpressRouteCircuitPeeringListResult} - 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. + * + * {ExpressRouteCircuitPeeringListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified peering from the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update express route circuit peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.azureASN] The Azure ASN. + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.primaryAzurePort] The primary port. + * + * @param {string} [peeringParameters.secondaryAzurePort] The secondary port. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {object} [peeringParameters.stats] Gets peering stats. + * + * @param {number} [peeringParameters.stats.primarybytesIn] Gets BytesIn of the + * peering. + * + * @param {number} [peeringParameters.stats.primarybytesOut] Gets BytesOut of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesIn] Gets BytesIn of + * the peering. + * + * @param {number} [peeringParameters.stats.secondarybytesOut] Gets BytesOut of + * the peering. + * + * @param {string} [peeringParameters.provisioningState] Gets the provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [peeringParameters.gatewayManagerEtag] The GatewayManager + * Etag. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.routeFilter] The reference of the + * RouteFilter resource. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {array} [peeringParameters.connections] The list of circuit + * connections associated with Azure Private Peering for this circuit. + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCircuitPeering} - 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. + * + * {ExpressRouteCircuitPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, peeringParameters: models.ExpressRouteCircuitPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all peerings in a specified express route circuit. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all peerings in a specified express route circuit. + * + * @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 {ExpressRouteCircuitPeeringListResult} - 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. + * + * {ExpressRouteCircuitPeeringListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitPeeringListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCircuitConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCircuitConnections { + + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuitConnection} - 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. + * + * {ExpressRouteCircuitConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 {ExpressRouteCircuitConnection} - 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. + * + * {ExpressRouteCircuitConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified Express Route Circuit Connection from the specified + * express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a Express Route Circuit Connection in the specified + * express route circuits. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} connectionName The name of the express route circuit + * connection. + * + * @param {object} expressRouteCircuitConnectionParameters Parameters supplied + * to the create or update express route circuit circuit connection operation. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.expressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the circuit + * initiating connection. + * + * @param {object} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering] + * Reference to Express Route Circuit Private Peering Resource of the peered + * circuit. + * + * @param {string} + * [expressRouteCircuitConnectionParameters.peerExpressRouteCircuitPeering.id] + * Resource ID. + * + * @param {string} [expressRouteCircuitConnectionParameters.addressPrefix] /29 + * IP address space to carve out Customer addresses for tunnels. + * + * @param {string} [expressRouteCircuitConnectionParameters.authorizationKey] + * The authorization key. + * + * @param {string} [expressRouteCircuitConnectionParameters.name] Gets name of + * the resource that is unique within a resource group. This name can be used + * to access the resource. + * + * @param {string} [expressRouteCircuitConnectionParameters.id] Resource 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 {ExpressRouteCircuitConnection} - 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. + * + * {ExpressRouteCircuitConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, peeringName: string, connectionName: string, expressRouteCircuitConnectionParameters: models.ExpressRouteCircuitConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCircuits + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCircuits { + + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of express route circuit. + * + * @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 {ExpressRouteCircuit} - 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. + * + * {ExpressRouteCircuit} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuit} - 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. + * + * {ExpressRouteCircuit} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuit} - 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. + * + * {ExpressRouteCircuit} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listArpTableWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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. + * + * {ExpressRouteCircuitsArpTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsArpTableListResult} 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. + */ + listArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + listRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableSummaryWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableSummaryListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableSummaryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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. + */ + listRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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. + */ + getStatsWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @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 {ExpressRouteCircuitStats} - 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. + * + * {ExpressRouteCircuitStats} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitStats} 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. + */ + getStats(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStats(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + getStats(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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. + */ + getPeeringStatsWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all stats from an express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCircuitStats} - 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. + * + * {ExpressRouteCircuitStats} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitStats} 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. + */ + getPeeringStats(resourceGroupName: string, circuitName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getPeeringStats(resourceGroupName: string, circuitName: string, peeringName: string, callback: ServiceCallback): void; + getPeeringStats(resourceGroupName: string, circuitName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuitListResult} - 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. + * + * {ExpressRouteCircuitListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the express route circuits in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the express route circuits in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuitListResult} - 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. + * + * {ExpressRouteCircuitListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, circuitName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, circuitName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, circuitName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates an express route circuit. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to the create or update + * express route circuit operation. + * + * @param {object} [parameters.sku] The SKU. + * + * @param {string} [parameters.sku.name] The name of the SKU. + * + * @param {string} [parameters.sku.tier] The tier of the SKU. Possible values + * are 'Standard' and 'Premium'. Possible values include: 'Standard', 'Premium' + * + * @param {string} [parameters.sku.family] The family of the SKU. Possible + * values are: 'UnlimitedData' and 'MeteredData'. Possible values include: + * 'UnlimitedData', 'MeteredData' + * + * @param {boolean} [parameters.allowClassicOperations] Allow classic + * operations + * + * @param {string} [parameters.circuitProvisioningState] The + * CircuitProvisioningState state of the resource. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * ServiceProviderProvisioningState state of the resource. Possible values are + * 'NotProvisioned', 'Provisioning', 'Provisioned', and 'Deprovisioning'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {array} [parameters.authorizations] The list of authorizations. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.serviceKey] The ServiceKey. + * + * @param {string} [parameters.serviceProviderNotes] The ServiceProviderNotes. + * + * @param {object} [parameters.serviceProviderProperties] The + * ServiceProviderProperties. + * + * @param {string} [parameters.serviceProviderProperties.serviceProviderName] + * The serviceProviderName. + * + * @param {string} [parameters.serviceProviderProperties.peeringLocation] The + * peering location. + * + * @param {number} [parameters.serviceProviderProperties.bandwidthInMbps] The + * BandwidthInMbps. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.gatewayManagerEtag] The GatewayManager Etag. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuit} - 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. + * + * {ExpressRouteCircuit} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, circuitName: string, parameters: models.ExpressRouteCircuit, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an express route circuit tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the circuit. + * + * @param {object} parameters Parameters supplied to update express route + * circuit tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuit} - 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. + * + * {ExpressRouteCircuit} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuit} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, circuitName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListArpTableWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised ARP table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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. + * + * {ExpressRouteCircuitsArpTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsArpTableListResult} 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. + */ + beginListArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListArpTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table associated with the express route + * circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + beginListRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListRoutesTable(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableSummaryWithHttpOperationResponse(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table summary associated with the + * express route circuit in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} circuitName The name of the express route circuit. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableSummaryListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableSummaryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ExpressRouteCircuitsRoutesTableSummaryListResult} 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. + */ + beginListRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListRoutesTableSummary(resourceGroupName: string, circuitName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the express route circuits in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuitListResult} - 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. + * + * {ExpressRouteCircuitListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the express route circuits in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the express route circuits in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCircuitListResult} - 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. + * + * {ExpressRouteCircuitListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteServiceProviders + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteServiceProviders { + + + /** + * Gets all the available express route service providers. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the available express route service providers. + * + * @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 {ExpressRouteServiceProviderListResult} - 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. + * + * {ExpressRouteServiceProviderListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteServiceProviderListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the available express route service providers. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the available express route service providers. + * + * @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 {ExpressRouteServiceProviderListResult} - 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. + * + * {ExpressRouteServiceProviderListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteServiceProviderListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCrossConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCrossConnections { + + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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. + * + * {ExpressRouteCrossConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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. + * + * {ExpressRouteCrossConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets details about the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group (peering + * location of the circuit). + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection (service key of the circuit). + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets details about the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group (peering + * location of the circuit). + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection (service key of the circuit). + * + * @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 {ExpressRouteCrossConnection} - 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. + * + * {ExpressRouteCrossConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, crossConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, crossConnectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, crossConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnection} - 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. + * + * {ExpressRouteCrossConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnection} - 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. + * + * {ExpressRouteCrossConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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. + */ + listArpTableWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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. + * + * {ExpressRouteCircuitsArpTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsArpTableListResult} 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. + */ + listArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableSummaryWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} - 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. + * + * {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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. + */ + listRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + listRoutesTableWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + listRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + listRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Update the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} parameters Parameters supplied to the update express route + * crossConnection operation. + * + * @param {string} [parameters.serviceProviderProvisioningState] The + * provisioning state of the circuit in the connectivity provider system. + * Possible values are 'NotProvisioned', 'Provisioning', 'Provisioned'. + * Possible values include: 'NotProvisioned', 'Provisioning', 'Provisioned', + * 'Deprovisioning' + * + * @param {string} [parameters.serviceProviderNotes] Additional read only notes + * set by the connectivity provider. + * + * @param {array} [parameters.peerings] The list of peerings. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnection} - 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. + * + * {ExpressRouteCrossConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, parameters: models.ExpressRouteCrossConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates an express route cross connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the cross connection. + * + * @param {object} crossConnectionParameters Parameters supplied to update + * express route cross connection tags. + * + * @param {object} [crossConnectionParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnection} - 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. + * + * {ExpressRouteCrossConnection} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, crossConnectionName: string, crossConnectionParameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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. + */ + beginListArpTableWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised ARP table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device + * + * @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 {ExpressRouteCircuitsArpTableListResult} - 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. + * + * {ExpressRouteCircuitsArpTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsArpTableListResult} 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. + */ + beginListArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListArpTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableSummaryWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the route table summary associated with the express route cross + * connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} - 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. + * + * {ExpressRouteCrossConnectionsRoutesTableSummaryListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * ExpressRouteCrossConnectionsRoutesTableSummaryListResult} + * 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. + */ + beginListRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListRoutesTableSummary(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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. + */ + beginListRoutesTableWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the currently advertised routes table associated with the express route + * cross connection in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {string} devicePath The path of the device. + * + * @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 {ExpressRouteCircuitsRoutesTableListResult} - 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. + * + * {ExpressRouteCircuitsRoutesTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCircuitsRoutesTableListResult} + * 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. + */ + beginListRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, callback: ServiceCallback): void; + beginListRoutesTable(resourceGroupName: string, crossConnectionName: string, peeringName: string, devicePath: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the ExpressRouteCrossConnections in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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. + * + * {ExpressRouteCrossConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Retrieves all the ExpressRouteCrossConnections in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ExpressRouteCrossConnectionListResult} - 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. + * + * {ExpressRouteCrossConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ExpressRouteCrossConnectionPeerings + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ExpressRouteCrossConnectionPeerings { + + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @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 {ExpressRouteCrossConnectionPeeringList} - 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. + * + * {ExpressRouteCrossConnectionPeeringList} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, crossConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, crossConnectionName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, crossConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified peering for the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified peering for the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @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 {ExpressRouteCrossConnectionPeering} - 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. + * + * {ExpressRouteCrossConnectionPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, crossConnectionName: string, peeringName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, crossConnectionName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCrossConnectionPeering} - 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. + * + * {ExpressRouteCrossConnectionPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified peering from the ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, crossConnectionName: string, peeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified ExpressRouteCrossConnection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} crossConnectionName The name of the + * ExpressRouteCrossConnection. + * + * @param {string} peeringName The name of the peering. + * + * @param {object} peeringParameters Parameters supplied to the create or + * update ExpressRouteCrossConnection peering operation. + * + * @param {string} [peeringParameters.peeringType] The peering type. Possible + * values include: 'AzurePublicPeering', 'AzurePrivatePeering', + * 'MicrosoftPeering' + * + * @param {string} [peeringParameters.state] The peering state. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {number} [peeringParameters.peerASN] The peer ASN. + * + * @param {string} [peeringParameters.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} [peeringParameters.secondaryPeerAddressPrefix] The secondary + * address prefix. + * + * @param {string} [peeringParameters.sharedKey] The shared key. + * + * @param {number} [peeringParameters.vlanId] The VLAN ID. + * + * @param {object} [peeringParameters.microsoftPeeringConfig] The Microsoft + * peering configuration. + * + * @param {string} [peeringParameters.lastModifiedBy] Gets whether the provider + * or the customer last modified the peering. + * + * @param {object} [peeringParameters.ipv6PeeringConfig] The IPv6 peering + * configuration. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.primaryPeerAddressPrefix] The primary + * address prefix. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.secondaryPeerAddressPrefix] The + * secondary address prefix. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig] + * The Microsoft peering configuration. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixes] + * The reference of AdvertisedPublicPrefixes. + * + * @param {array} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedCommunities] + * The communities of bgp peering. Spepcified for microsoft peering + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.advertisedPublicPrefixesState] + * AdvertisedPublicPrefixState of the Peering resource. Possible values are + * 'NotConfigured', 'Configuring', 'Configured', and 'ValidationNeeded'. + * Possible values include: 'NotConfigured', 'Configuring', 'Configured', + * 'ValidationNeeded' + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.legacyMode] The + * legacy mode of the peering. + * + * @param {number} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.customerASN] The + * CustomerASN of the peering. + * + * @param {string} + * [peeringParameters.ipv6PeeringConfig.microsoftPeeringConfig.routingRegistryName] + * The RoutingRegistryName of the configuration. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter] The + * reference of the RouteFilter resource. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.rules] + * Collection of RouteFilterRules contained within a route filter. + * + * @param {array} [peeringParameters.ipv6PeeringConfig.routeFilter.peerings] A + * collection of references to express route circuit peerings. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.id] + * Resource ID. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.routeFilter.location] + * Resource location. + * + * @param {object} [peeringParameters.ipv6PeeringConfig.routeFilter.tags] + * Resource tags. + * + * @param {string} [peeringParameters.ipv6PeeringConfig.state] The state of + * peering. Possible values are: 'Disabled' and 'Enabled'. Possible values + * include: 'Disabled', 'Enabled' + * + * @param {string} [peeringParameters.name] Gets name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [peeringParameters.id] Resource 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 {ExpressRouteCrossConnectionPeering} - 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. + * + * {ExpressRouteCrossConnectionPeering} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionPeering} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, crossConnectionName: string, peeringName: string, peeringParameters: models.ExpressRouteCrossConnectionPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all peerings in a specified ExpressRouteCrossConnection. + * + * @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 {ExpressRouteCrossConnectionPeeringList} - 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. + * + * {ExpressRouteCrossConnectionPeeringList} [result] - The deserialized result object if an error did not occur. + * See {@link ExpressRouteCrossConnectionPeeringList} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancers + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancers { + + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {LoadBalancer} - 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. + * + * {LoadBalancer} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {LoadBalancer} - 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. + * + * {LoadBalancer} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancer} - 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. + * + * {LoadBalancer} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancers in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancers in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerListResult} - 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. + * + * {LoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerListResult} - 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. + * + * {LoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {LoadBalancer} - 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. + * + * {LoadBalancer} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, parameters: models.LoadBalancer, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancer} - 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. + * + * {LoadBalancer} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, loadBalancerName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancers in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancers in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerListResult} - 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. + * + * {LoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerListResult} - 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. + * + * {LoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancerBackendAddressPools + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerBackendAddressPools { + + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerBackendAddressPoolListResult} - 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. + * + * {LoadBalancerBackendAddressPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets load balancer backend address pool. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} backendAddressPoolName The name of the backend address pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, backendAddressPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets load balancer backend address pool. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} backendAddressPoolName The name of the backend address pool. + * + * @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 {BackendAddressPool} - 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. + * + * {BackendAddressPool} [result] - The deserialized result object if an error did not occur. + * See {@link BackendAddressPool} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, backendAddressPoolName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, backendAddressPoolName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, backendAddressPoolName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer backed address pools. + * + * @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 {LoadBalancerBackendAddressPoolListResult} - 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. + * + * {LoadBalancerBackendAddressPoolListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancerFrontendIPConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerFrontendIPConfigurations { + + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerFrontendIPConfigurationListResult} - 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. + * + * {LoadBalancerFrontendIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets load balancer frontend IP configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} frontendIPConfigurationName The name of the frontend IP + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, frontendIPConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets load balancer frontend IP configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} frontendIPConfigurationName The name of the frontend IP + * configuration. + * + * @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 {FrontendIPConfiguration} - 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. + * + * {FrontendIPConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link FrontendIPConfiguration} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, frontendIPConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, frontendIPConfigurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, frontendIPConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer frontend IP configurations. + * + * @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 {LoadBalancerFrontendIPConfigurationListResult} - 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. + * + * {LoadBalancerFrontendIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * InboundNatRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface InboundNatRules { + + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {InboundNatRuleListResult} - 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. + * + * {InboundNatRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {InboundNatRule} - 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. + * + * {InboundNatRule} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 {InboundNatRule} - 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. + * + * {InboundNatRule} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a load balancer inbound nat rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} inboundNatRuleName The name of the inbound nat rule. + * + * @param {object} inboundNatRuleParameters Parameters supplied to the create + * or update inbound nat rule operation. + * + * @param {object} [inboundNatRuleParameters.frontendIPConfiguration] A + * reference to frontend IP addresses. + * + * @param {string} [inboundNatRuleParameters.frontendIPConfiguration.id] + * Resource ID. + * + * @param {string} [inboundNatRuleParameters.protocol] Possible values include: + * 'Udp', 'Tcp', 'All' + * + * @param {number} [inboundNatRuleParameters.frontendPort] The port for the + * external endpoint. Port numbers for each rule must be unique within the Load + * Balancer. Acceptable values range from 1 to 65534. + * + * @param {number} [inboundNatRuleParameters.backendPort] The port used for the + * internal endpoint. Acceptable values range from 1 to 65535. + * + * @param {number} [inboundNatRuleParameters.idleTimeoutInMinutes] The timeout + * for the TCP idle connection. The value can be set between 4 and 30 minutes. + * The default value is 4 minutes. This element is only used when the protocol + * is set to TCP. + * + * @param {boolean} [inboundNatRuleParameters.enableFloatingIP] Configures a + * virtual machine's endpoint for the floating IP capability required to + * configure a SQL AlwaysOn Availability Group. This setting is required when + * using the SQL AlwaysOn Availability Groups in SQL server. This setting can't + * be changed after you create the endpoint. + * + * @param {string} [inboundNatRuleParameters.provisioningState] Gets the + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [inboundNatRuleParameters.name] Gets name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [inboundNatRuleParameters.etag] A unique read-only string + * that changes whenever the resource is updated. + * + * @param {string} [inboundNatRuleParameters.id] Resource 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 {InboundNatRule} - 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. + * + * {InboundNatRule} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, loadBalancerName: string, inboundNatRuleName: string, inboundNatRuleParameters: models.InboundNatRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the inbound nat rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {InboundNatRuleListResult} - 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. + * + * {InboundNatRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link InboundNatRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancerLoadBalancingRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerLoadBalancingRules { + + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerLoadBalancingRuleListResult} - 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. + * + * {LoadBalancerLoadBalancingRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified load balancer load balancing rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} loadBalancingRuleName The name of the load balancing rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, loadBalancingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified load balancer load balancing rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} loadBalancingRuleName The name of the load balancing rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancingRule} - 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. + * + * {LoadBalancingRule} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, loadBalancingRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, loadBalancingRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, loadBalancingRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerLoadBalancingRuleListResult} - 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. + * + * {LoadBalancerLoadBalancingRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancerNetworkInterfaces + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerNetworkInterfaces { + + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets associated load balancer network interfaces. + * + * @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 {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LoadBalancerProbes + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LoadBalancerProbes { + + + /** + * Gets all the load balancer probes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer probes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LoadBalancerProbeListResult} - 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. + * + * {LoadBalancerProbeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerProbeListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, loadBalancerName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, loadBalancerName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, loadBalancerName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets load balancer probe. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} probeName The name of the probe. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, loadBalancerName: string, probeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets load balancer probe. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} probeName The name of the probe. + * + * @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 {Probe} - 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. + * + * {Probe} [result] - The deserialized result object if an error did not occur. + * See {@link Probe} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, loadBalancerName: string, probeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, loadBalancerName: string, probeName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, loadBalancerName: string, probeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the load balancer probes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the load balancer probes. + * + * @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 {LoadBalancerProbeListResult} - 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. + * + * {LoadBalancerProbeListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerProbeListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NetworkInterfaces + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface NetworkInterfaces { + + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkInterfaceName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + getEffectiveRouteTableWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveRouteListResult} - 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. + * + * {EffectiveRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EffectiveRouteListResult} 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. + */ + getEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + getEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + listEffectiveNetworkSecurityGroupsWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveNetworkSecurityGroupListResult} - 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. + * + * {EffectiveNetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EffectiveNetworkSecurityGroupListResult} 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. + */ + listEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + listEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @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 {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetNetworkInterfacesWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName: string, virtualMachineScaleSetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified network interface in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetNetworkInterfaceWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified network interface in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} 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. + */ + getVirtualMachineScaleSetNetworkInterface(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getVirtualMachineScaleSetNetworkInterface(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, callback: ServiceCallback): void; + getVirtualMachineScaleSetNetworkInterface(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + listVirtualMachineScaleSetIpConfigurationsWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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. + * + * {NetworkInterfaceIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfigurationListResult} + * 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. + */ + listVirtualMachineScaleSetIpConfigurations(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetIpConfigurations(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetIpConfigurations(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetIpConfigurationWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterfaceIPConfiguration} - 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. + * + * {NetworkInterfaceIPConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfiguration} 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. + */ + getVirtualMachineScaleSetIpConfiguration(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getVirtualMachineScaleSetIpConfiguration(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, callback: ServiceCallback): void; + getVirtualMachineScaleSetIpConfiguration(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, networkInterfaceName: string, parameters: models.NetworkInterface, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterface} - 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. + * + * {NetworkInterface} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, networkInterfaceName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + beginGetEffectiveRouteTableWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveRouteListResult} - 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. + * + * {EffectiveRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EffectiveRouteListResult} 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. + */ + beginGetEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + beginGetEffectiveRouteTable(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + beginListEffectiveNetworkSecurityGroupsWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveNetworkSecurityGroupListResult} - 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. + * + * {EffectiveNetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link EffectiveNetworkSecurityGroupListResult} 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. + */ + beginListEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginListEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + beginListEffectiveNetworkSecurityGroups(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @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 {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetNetworkInterfacesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @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 {NetworkInterfaceListResult} - 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. + * + * {NetworkInterfaceListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetIpConfigurationsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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. + * + * {NetworkInterfaceIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfigurationListResult} + * 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. + */ + listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NetworkInterfaceIPConfigurations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface NetworkInterfaceIPConfigurations { + + + /** + * Get all ip configurations in a network interface + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all ip configurations in a network interface + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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. + * + * {NetworkInterfaceIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified network interface ip configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, ipConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified network interface ip configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration name. + * + * @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 {NetworkInterfaceIPConfiguration} - 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. + * + * {NetworkInterfaceIPConfiguration} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfiguration} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkInterfaceName: string, ipConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkInterfaceName: string, ipConfigurationName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkInterfaceName: string, ipConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get all ip configurations in a network interface + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get all ip configurations in a network interface + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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. + * + * {NetworkInterfaceIPConfigurationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NetworkInterfaceLoadBalancers + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface NetworkInterfaceLoadBalancers { + + + /** + * List all load balancers in a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all load balancers in a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {NetworkInterfaceLoadBalancerListResult} - 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. + * + * {NetworkInterfaceLoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkInterfaceName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkInterfaceName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkInterfaceName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List all load balancers in a network interface. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List all load balancers in a network interface. + * + * @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 {NetworkInterfaceLoadBalancerListResult} - 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. + * + * {NetworkInterfaceLoadBalancerListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NetworkSecurityGroups + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface NetworkSecurityGroups { + + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkSecurityGroup} - 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. + * + * {NetworkSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkSecurityGroupName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkSecurityGroupName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkSecurityGroupName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {NetworkSecurityGroup} - 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. + * + * {NetworkSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroup} - 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. + * + * {NetworkSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroupListResult} - 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. + * + * {NetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroupListResult} - 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. + * + * {NetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {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 {NetworkSecurityGroup} - 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. + * + * {NetworkSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.NetworkSecurityGroup, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroup} - 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. + * + * {NetworkSecurityGroup} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, networkSecurityGroupName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroupListResult} - 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. + * + * {NetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkSecurityGroupListResult} - 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. + * + * {NetworkSecurityGroupListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * SecurityRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface SecurityRules { + + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRule} - 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. + * + * {SecurityRule} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 {SecurityRule} - 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. + * + * {SecurityRule} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRuleListResult} - 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. + * + * {SecurityRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkSecurityGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 {SecurityRule} - 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. + * + * {SecurityRule} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, networkSecurityGroupName: string, securityRuleName: string, securityRuleParameters: models.SecurityRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRuleListResult} - 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. + * + * {SecurityRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * DefaultSecurityRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface DefaultSecurityRules { + + + /** + * Gets all default security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all default security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRuleListResult} - 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. + * + * {SecurityRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkSecurityGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkSecurityGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkSecurityGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified default network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} defaultSecurityRuleName The name of the default security + * rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkSecurityGroupName: string, defaultSecurityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified default network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} defaultSecurityRuleName The name of the default security + * rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRule} - 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. + * + * {SecurityRule} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkSecurityGroupName: string, defaultSecurityRuleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkSecurityGroupName: string, defaultSecurityRuleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkSecurityGroupName: string, defaultSecurityRuleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all default security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all default security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {SecurityRuleListResult} - 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. + * + * {SecurityRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * NetworkWatchers + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface NetworkWatchers { + + + /** + * 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkWatcher, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * 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 {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 {NetworkWatcher} - 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. + * + * {NetworkWatcher} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcher} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkWatcher, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkWatcher, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, networkWatcherName: string, parameters: models.NetworkWatcher, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified network watcher by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified network watcher by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @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 {NetworkWatcher} - 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. + * + * {NetworkWatcher} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcher} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkWatcherName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkWatcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkWatcherName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkWatcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a network watcher tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters supplied to update network watcher + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a network watcher tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters supplied to update network watcher + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkWatcher} - 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. + * + * {NetworkWatcher} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcher} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, networkWatcherName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, networkWatcherName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, networkWatcherName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network watchers by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network watchers by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkWatcherListResult} - 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. + * + * {NetworkWatcherListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcherListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all network watchers by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all network watchers by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {NetworkWatcherListResult} - 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. + * + * {NetworkWatcherListResult} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcherListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the current network topology by 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 representation of + * topology. + * + * @param {string} [parameters.targetResourceGroupName] The name of the target + * resource group to perform topology on. + * + * @param {object} [parameters.targetVirtualNetwork] The reference of the + * Virtual Network resource. + * + * @param {object} [parameters.targetSubnet] The reference of the Subnet + * resource. + * + * @param {string} [parameters.targetSubnet.id] Resource 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. + */ + getTopologyWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.TopologyParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the current network topology by 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 representation of + * topology. + * + * @param {string} [parameters.targetResourceGroupName] The name of the target + * resource group to perform topology on. + * + * @param {object} [parameters.targetVirtualNetwork] The reference of the + * Virtual Network resource. + * + * @param {object} [parameters.targetSubnet] The reference of the Subnet + * resource. + * + * @param {string} [parameters.targetSubnet.id] Resource 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 {Topology} - 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. + * + * {Topology} [result] - The deserialized result object if an error did not occur. + * See {@link Topology} 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. + */ + getTopology(resourceGroupName: string, networkWatcherName: string, parameters: models.TopologyParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getTopology(resourceGroupName: string, networkWatcherName: string, parameters: models.TopologyParameters, callback: ServiceCallback): void; + getTopology(resourceGroupName: string, networkWatcherName: string, parameters: models.TopologyParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + verifyIPFlowWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 {VerificationIPFlowResult} - 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. + * + * {VerificationIPFlowResult} [result] - The deserialized result object if an error did not occur. + * See {@link VerificationIPFlowResult} 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. + */ + verifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + verifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, callback: ServiceCallback): void; + verifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + getNextHopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 {NextHopResult} - 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. + * + * {NextHopResult} [result] - The deserialized result object if an error did not occur. + * See {@link NextHopResult} 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. + */ + getNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, callback: ServiceCallback): void; + getNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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. + */ + getVMSecurityRulesWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 {SecurityGroupViewResult} - 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. + * + * {SecurityGroupViewResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityGroupViewResult} 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. + */ + getVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, callback: ServiceCallback): void; + getVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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. + */ + getTroubleshootingWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 {TroubleshootingResult} - 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. + * + * {TroubleshootingResult} [result] - The deserialized result object if an error did not occur. + * See {@link TroubleshootingResult} 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. + */ + getTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, callback: ServiceCallback): void; + getTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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. + */ + getTroubleshootingResultWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 {TroubleshootingResult} - 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. + * + * {TroubleshootingResult} [result] - The deserialized result object if an error did not occur. + * See {@link TroubleshootingResult} 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. + */ + getTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, callback: ServiceCallback): void; + getTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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. + */ + setFlowLogConfigurationWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 {FlowLogInformation} - 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. + * + * {FlowLogInformation} [result] - The deserialized result object if an error did not occur. + * See {@link FlowLogInformation} 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. + */ + setFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + setFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, callback: ServiceCallback): void; + setFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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. + */ + getFlowLogStatusWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 {FlowLogInformation} - 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. + * + * {FlowLogInformation} [result] - The deserialized result object if an error did not occur. + * See {@link FlowLogInformation} 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. + */ + getFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, callback: ServiceCallback): void; + getFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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. + */ + checkConnectivityWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 {ConnectivityInformation} - 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. + * + * {ConnectivityInformation} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectivityInformation} 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. + */ + checkConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + checkConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, callback: ServiceCallback): void; + checkConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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. + */ + getAzureReachabilityReportWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 {AzureReachabilityReport} - 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. + * + * {AzureReachabilityReport} [result] - The deserialized result object if an error did not occur. + * See {@link AzureReachabilityReport} 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. + */ + getAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, callback: ServiceCallback): void; + getAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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. + */ + listAvailableProvidersWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 {AvailableProvidersList} - 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. + * + * {AvailableProvidersList} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableProvidersList} 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. + */ + listAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, callback: ServiceCallback): void; + listAvailableProviders(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + beginVerifyIPFlowWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 {VerificationIPFlowResult} - 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. + * + * {VerificationIPFlowResult} [result] - The deserialized result object if an error did not occur. + * See {@link VerificationIPFlowResult} 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. + */ + beginVerifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginVerifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, callback: ServiceCallback): void; + beginVerifyIPFlow(resourceGroupName: string, networkWatcherName: string, parameters: models.VerificationIPFlowParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + beginGetNextHopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 {NextHopResult} - 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. + * + * {NextHopResult} [result] - The deserialized result object if an error did not occur. + * See {@link NextHopResult} 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. + */ + beginGetNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, callback: ServiceCallback): void; + beginGetNextHop(resourceGroupName: string, networkWatcherName: string, parameters: models.NextHopParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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. + */ + beginGetVMSecurityRulesWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 {SecurityGroupViewResult} - 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. + * + * {SecurityGroupViewResult} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityGroupViewResult} 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. + */ + beginGetVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, callback: ServiceCallback): void; + beginGetVMSecurityRules(resourceGroupName: string, networkWatcherName: string, parameters: models.SecurityGroupViewParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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. + */ + beginGetTroubleshootingWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 {TroubleshootingResult} - 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. + * + * {TroubleshootingResult} [result] - The deserialized result object if an error did not occur. + * See {@link TroubleshootingResult} 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. + */ + beginGetTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, callback: ServiceCallback): void; + beginGetTroubleshooting(resourceGroupName: string, networkWatcherName: string, parameters: models.TroubleshootingParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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. + */ + beginGetTroubleshootingResultWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 {TroubleshootingResult} - 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. + * + * {TroubleshootingResult} [result] - The deserialized result object if an error did not occur. + * See {@link TroubleshootingResult} 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. + */ + beginGetTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, callback: ServiceCallback): void; + beginGetTroubleshootingResult(resourceGroupName: string, networkWatcherName: string, parameters: models.QueryTroubleshootingParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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. + */ + beginSetFlowLogConfigurationWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 {FlowLogInformation} - 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. + * + * {FlowLogInformation} [result] - The deserialized result object if an error did not occur. + * See {@link FlowLogInformation} 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. + */ + beginSetFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginSetFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, callback: ServiceCallback): void; + beginSetFlowLogConfiguration(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogInformation, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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. + */ + beginGetFlowLogStatusWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 {FlowLogInformation} - 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. + * + * {FlowLogInformation} [result] - The deserialized result object if an error did not occur. + * See {@link FlowLogInformation} 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. + */ + beginGetFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, callback: ServiceCallback): void; + beginGetFlowLogStatus(resourceGroupName: string, networkWatcherName: string, parameters: models.FlowLogStatusParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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. + */ + beginCheckConnectivityWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 {ConnectivityInformation} - 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. + * + * {ConnectivityInformation} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectivityInformation} 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. + */ + beginCheckConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCheckConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, callback: ServiceCallback): void; + beginCheckConnectivity(resourceGroupName: string, networkWatcherName: string, parameters: models.ConnectivityParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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. + */ + beginGetAzureReachabilityReportWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 {AzureReachabilityReport} - 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. + * + * {AzureReachabilityReport} [result] - The deserialized result object if an error did not occur. + * See {@link AzureReachabilityReport} 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. + */ + beginGetAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, callback: ServiceCallback): void; + beginGetAzureReachabilityReport(resourceGroupName: string, networkWatcherName: string, parameters: models.AzureReachabilityReportParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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. + */ + beginListAvailableProvidersWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, parameters: models.AvailableProvidersListParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 {AvailableProvidersList} - 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. + * + * {AvailableProvidersList} [result] - The deserialized result object if an error did not occur. + * See {@link AvailableProvidersList} 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. + */ + 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; +} + +/** + * @class + * PacketCaptures + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface PacketCaptures { + + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 {PacketCaptureResult} - 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. + * + * {PacketCaptureResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureResult} 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. + */ + create(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + create(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, callback: ServiceCallback): void; + create(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a packet capture session by name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a packet capture session by name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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 {PacketCaptureResult} - 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. + * + * {PacketCaptureResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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. + */ + getStatusWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 {PacketCaptureQueryStatusResult} - 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. + * + * {PacketCaptureQueryStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureQueryStatusResult} 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. + */ + getStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + getStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all packet capture sessions within the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all packet capture sessions within the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PacketCaptureListResult} - 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. + * + * {PacketCaptureListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkWatcherName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkWatcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 {PacketCaptureResult} - 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. + * + * {PacketCaptureResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureResult} 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. + */ + beginCreate(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreate(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, callback: ServiceCallback): void; + beginCreate(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, parameters: models.PacketCapture, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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. + */ + beginGetStatusWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 {PacketCaptureQueryStatusResult} - 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. + * + * {PacketCaptureQueryStatusResult} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureQueryStatusResult} 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. + */ + beginGetStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, callback: ServiceCallback): void; + beginGetStatus(resourceGroupName: string, networkWatcherName: string, packetCaptureName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * ConnectionMonitors + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface ConnectionMonitors { + + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 {ConnectionMonitorResult} - 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. + * + * {ConnectionMonitorResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a connection monitor by name. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a connection monitor by name. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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 {ConnectionMonitorResult} - 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. + * + * {ConnectionMonitorResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + stop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + stop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + startWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + start(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + start(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + start(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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. + */ + queryWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 {ConnectionMonitorQueryResult} - 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. + * + * {ConnectionMonitorQueryResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorQueryResult} 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. + */ + query(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + query(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + query(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all connection monitors for the specified Network Watcher. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all connection monitors for the specified Network Watcher. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {ConnectionMonitorListResult} - 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. + * + * {ConnectionMonitorListResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, networkWatcherName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, networkWatcherName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, networkWatcherName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or update a connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} parameters Parameters that define the operation to create a + * connection monitor. + * + * @param {string} [parameters.location] Connection monitor location. + * + * @param {object} [parameters.tags] Connection monitor tags. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource used as + * the source by connection monitor. + * + * @param {number} [parameters.source.port] The source port used by connection + * monitor. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * used as the destination by connection monitor. + * + * @param {string} [parameters.destination.address] Address of the connection + * monitor destination (IP or domain name). + * + * @param {number} [parameters.destination.port] The destination port used by + * connection monitor. + * + * @param {boolean} [parameters.autoStart] Determines if the connection monitor + * will start automatically once created. + * + * @param {number} [parameters.monitoringIntervalInSeconds] Monitoring interval + * in seconds. + * + * @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 {ConnectionMonitorResult} - 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. + * + * {ConnectionMonitorResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, parameters: models.ConnectionMonitor, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + beginStopWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Stops the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + beginStop(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @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. + */ + beginStartWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Starts the specified connection monitor. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name of the connection monitor. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginStart(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginStart(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + beginStart(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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. + */ + beginQueryWithHttpOperationResponse(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Query a snapshot of the most recent connection states. + * + * @param {string} resourceGroupName The name of the resource group containing + * Network Watcher. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} connectionMonitorName The name given to the connection + * monitor. + * + * @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 {ConnectionMonitorQueryResult} - 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. + * + * {ConnectionMonitorQueryResult} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionMonitorQueryResult} 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. + */ + beginQuery(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginQuery(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, callback: ServiceCallback): void; + beginQuery(resourceGroupName: string, networkWatcherName: string, connectionMonitorName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Operations + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface Operations { + + + /** + * Lists all of the available Network Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Network Rest API operations. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists all of the available Network Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists all of the available Network Rest API operations. + * + * @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 {OperationListResult} - 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. + * + * {OperationListResult} [result] - The deserialized result object if an error did not occur. + * See {@link OperationListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * PublicIPAddresses + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface PublicIPAddresses { + + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, publicIpAddressName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, publicIpAddressName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, publicIpAddressName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified public IP address in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified public IP address in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, publicIpAddressName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, publicIpAddressName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, publicIpAddressName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetPublicIPAddressesWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The network interface name. + * + * @param {string} ipConfigurationName The IP configuration name. + * + * @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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The network interface name. + * + * @param {string} ipConfigurationName The IP configuration name. + * + * @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 {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Get the specified public IP address in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the IP configuration. + * + * @param {string} publicIpAddressName The name of the public IP Address. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetPublicIPAddressWithHttpOperationResponse(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, publicIpAddressName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Get the specified public IP address in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the IP configuration. + * + * @param {string} publicIpAddressName The name of the public IP Address. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} 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. + */ + getVirtualMachineScaleSetPublicIPAddress(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, publicIpAddressName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getVirtualMachineScaleSetPublicIPAddress(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, publicIpAddressName: string, callback: ServiceCallback): void; + getVirtualMachineScaleSetPublicIPAddress(resourceGroupName: string, virtualMachineScaleSetName: string, virtualmachineIndex: string, networkInterfaceName: string, ipConfigurationName: string, publicIpAddressName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, publicIpAddressName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, publicIpAddressName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, publicIpAddressName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, publicIpAddressName: string, parameters: models.PublicIPAddress, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddress} - 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. + * + * {PublicIPAddress} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, publicIpAddressName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @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. + */ + listVirtualMachineScaleSetPublicIPAddressesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @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 {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @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 {PublicIPAddressListResult} - 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. + * + * {PublicIPAddressListResult} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink: string, callback: ServiceCallback): void; + listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RouteFilters + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface RouteFilters { + + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, routeFilterName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, routeFilterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced express route bgp + * peering resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced express route bgp + * peering resources. + * + * @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 {RouteFilter} - 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. + * + * {RouteFilter} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, routeFilterName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, routeFilterName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, routeFilterName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilter} - 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. + * + * {RouteFilter} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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. + */ + updateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 {RouteFilter} - 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. + * + * {RouteFilter} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} 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. + */ + update(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, callback: ServiceCallback): void; + update(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route filters in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route filters in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilterListResult} - 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. + * + * {RouteFilterListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroup(resourceGroupName: string, callback: ServiceCallback): void; + listByResourceGroup(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route filters in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route filters in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilterListResult} - 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. + * + * {RouteFilterListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilter} - 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. + * + * {RouteFilter} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.RouteFilter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 {RouteFilter} - 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. + * + * {RouteFilter} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} 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. + */ + beginUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, routeFilterName: string, routeFilterParameters: models.PatchRouteFilter, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route filters in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route filters in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilterListResult} - 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. + * + * {RouteFilterListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByResourceGroupNext(nextPageLink: string, callback: ServiceCallback): void; + listByResourceGroupNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route filters in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route filters in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilterListResult} - 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. + * + * {RouteFilterListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RouteFilterRules + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface RouteFilterRules { + + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteFilterRule} - 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. + * + * {RouteFilterRule} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, routeFilterName: string, ruleName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, routeFilterName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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. + * + * {RouteFilterRule} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + updateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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. + * + * {RouteFilterRule} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} 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. + */ + update(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + update(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, callback: ServiceCallback): void; + update(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all RouteFilterRules in a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @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. + */ + listByRouteFilterWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all RouteFilterRules in a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @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 {RouteFilterRuleListResult} - 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. + * + * {RouteFilterRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRuleListResult} 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. + */ + listByRouteFilter(resourceGroupName: string, routeFilterName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByRouteFilter(resourceGroupName: string, routeFilterName: string, callback: ServiceCallback): void; + listByRouteFilter(resourceGroupName: string, routeFilterName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, routeFilterName: string, ruleName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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. + * + * {RouteFilterRule} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.RouteFilterRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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. + * + * {RouteFilterRule} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} 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. + */ + beginUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, callback: ServiceCallback): void; + beginUpdate(resourceGroupName: string, routeFilterName: string, ruleName: string, routeFilterRuleParameters: models.PatchRouteFilterRule, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all RouteFilterRules in a route filter. + * + * @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. + */ + listByRouteFilterNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all RouteFilterRules in a route filter. + * + * @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 {RouteFilterRuleListResult} - 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. + * + * {RouteFilterRuleListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRuleListResult} 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. + */ + listByRouteFilterNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listByRouteFilterNext(nextPageLink: string, callback: ServiceCallback): void; + listByRouteFilterNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * RouteTables + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface RouteTables { + + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, routeTableName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, routeTableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {RouteTable} - 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. + * + * {RouteTable} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, routeTableName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, routeTableName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, routeTableName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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 {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 {RouteTable} - 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. + * + * {RouteTable} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTable} - 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. + * + * {RouteTable} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTableListResult} - 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. + * + * {RouteTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTableListResult} - 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. + * + * {RouteTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, routeTableName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, routeTableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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 {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 {RouteTable} - 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. + * + * {RouteTable} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, parameters: models.RouteTable, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTable} - 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. + * + * {RouteTable} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, routeTableName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTableListResult} - 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. + * + * {RouteTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all route tables in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all route tables in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {RouteTableListResult} - 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. + * + * {RouteTableListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Routes + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface Routes { + + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @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 {Route} - 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. + * + * {Route} [result] - The deserialized result object if an error did not occur. + * See {@link Route} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, routeTableName: string, routeName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, routeTableName: string, routeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 {Route} - 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. + * + * {Route} [result] - The deserialized result object if an error did not occur. + * See {@link Route} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all routes in a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all routes in a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @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 {RouteListResult} - 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. + * + * {RouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, routeTableName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, routeTableName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, routeTableName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, routeTableName: string, routeName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 {Route} - 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. + * + * {Route} [result] - The deserialized result object if an error did not occur. + * See {@link Route} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, routeTableName: string, routeName: string, routeParameters: models.Route, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all routes in a route table. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all routes in a route table. + * + * @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 {RouteListResult} - 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. + * + * {RouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link RouteListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * BgpServiceCommunities + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface BgpServiceCommunities { + + + /** + * Gets all the available bgp service communities. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the available bgp service communities. + * + * @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 {BgpServiceCommunityListResult} - 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. + * + * {BgpServiceCommunityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BgpServiceCommunityListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(callback: ServiceCallback): void; + list(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the available bgp service communities. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the available bgp service communities. + * + * @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 {BgpServiceCommunityListResult} - 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. + * + * {BgpServiceCommunityListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BgpServiceCommunityListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Usages + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface Usages { + + + /** + * List network usages for a subscription. + * + * @param {string} location The location where resource usage is queried. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List network usages for a subscription. + * + * @param {string} location The location where resource usage is queried. + * + * @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 {UsagesListResult} - 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. + * + * {UsagesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsagesListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(location: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(location: string, callback: ServiceCallback): void; + list(location: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * List network usages for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * List network usages for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {UsagesListResult} - 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. + * + * {UsagesListResult} [result] - The deserialized result object if an error did not occur. + * See {@link UsagesListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualNetworks + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualNetworks { + + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified virtual network by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified virtual network by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {VirtualNetwork} - 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. + * + * {VirtualNetwork} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, virtualNetworkName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualNetworkName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetwork} - 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. + * + * {VirtualNetwork} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetwork} - 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. + * + * {VirtualNetwork} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual networks in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllWithHttpOperationResponse(options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual networks in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkListResult} - 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. + * + * {VirtualNetworkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} 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. + */ + listAll(options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAll(callback: ServiceCallback): void; + listAll(options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkListResult} - 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. + * + * {VirtualNetworkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Checks whether a private IP address is available for use. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ipAddress] The private IP address to be verified. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + checkIPAddressAvailabilityWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Checks whether a private IP address is available for use. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ipAddress] The private IP address to be verified. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @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 {IPAddressAvailabilityResult} - 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. + * + * {IPAddressAvailabilityResult} [result] - The deserialized result object if an error did not occur. + * See {@link IPAddressAvailabilityResult} 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. + */ + checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, options?: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + checkIPAddressAvailability(resourceGroupName: string, virtualNetworkName: string, options: { ipAddress? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists usage stats. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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. + */ + listUsageWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists usage stats. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {VirtualNetworkListUsageResult} - 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. + * + * {VirtualNetworkListUsageResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListUsageResult} 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. + */ + listUsage(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listUsage(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + listUsage(resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetwork} - 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. + * + * {VirtualNetwork} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, parameters: models.VirtualNetwork, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetwork} - 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. + * + * {VirtualNetwork} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualNetworkName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual networks in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual networks in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkListResult} - 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. + * + * {VirtualNetworkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} 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. + */ + listAllNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listAllNext(nextPageLink: string, callback: ServiceCallback): void; + listAllNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkListResult} - 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. + * + * {VirtualNetworkListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Lists usage stats. + * + * @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. + */ + listUsageNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Lists usage stats. + * + * @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 {VirtualNetworkListUsageResult} - 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. + * + * {VirtualNetworkListUsageResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListUsageResult} 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. + */ + listUsageNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listUsageNext(nextPageLink: string, callback: ServiceCallback): void; + listUsageNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * Subnets + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface Subnets { + + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified subnet by virtual network and resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified subnet by virtual network and resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {Subnet} - 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. + * + * {Subnet} [result] - The deserialized result object if an error did not occur. + * See {@link Subnet} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { expand? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualNetworkName: string, subnetName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options: { expand? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 {Subnet} - 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. + * + * {Subnet} [result] - The deserialized result object if an error did not occur. + * See {@link Subnet} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all subnets in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all subnets in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {SubnetListResult} - 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. + * + * {SubnetListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SubnetListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, subnetName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 {Subnet} - 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. + * + * {Subnet} [result] - The deserialized result object if an error did not occur. + * See {@link Subnet} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, subnetName: string, subnetParameters: models.Subnet, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all subnets in a virtual network. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all subnets in a virtual network. + * + * @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 {SubnetListResult} - 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. + * + * {SubnetListResult} [result] - The deserialized result object if an error did not occur. + * See {@link SubnetListResult} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualNetworkPeerings + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualNetworkPeerings { + + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @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 {VirtualNetworkPeering} - 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. + * + * {VirtualNetworkPeering} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkPeering} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 {VirtualNetworkPeering} - 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. + * + * {VirtualNetworkPeering} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkPeering} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {VirtualNetworkPeeringListResult} - 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. + * + * {VirtualNetworkPeeringListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkPeeringListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, virtualNetworkName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, virtualNetworkName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, virtualNetworkName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 {VirtualNetworkPeering} - 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. + * + * {VirtualNetworkPeering} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkPeering} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkName: string, virtualNetworkPeeringName: string, virtualNetworkPeeringParameters: models.VirtualNetworkPeering, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual network peerings in a virtual network. + * + * @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 {VirtualNetworkPeeringListResult} - 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. + * + * {VirtualNetworkPeeringListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkPeeringListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualNetworkGateways + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualNetworkGateways { + + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified virtual network gateway by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified virtual network gateway by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayListResult} - 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. + * + * {VirtualNetworkGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + listConnectionsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {VirtualNetworkGatewayListConnectionsResult} - 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. + * + * {VirtualNetworkGatewayListConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListConnectionsResult} + * 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. + */ + listConnections(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listConnections(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + listConnections(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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. + */ + resetWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} 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. + */ + reset(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + reset(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + reset(resourceGroupName: string, virtualNetworkGatewayName: string, options: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + generatevpnclientpackageWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + generatevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + generatevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, callback: ServiceCallback): void; + generatevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + generateVpnProfileWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + generateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + generateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, callback: ServiceCallback): void; + generateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + getVpnProfilePackageUrlWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + getVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + getVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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. + */ + getBgpPeerStatusWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { peer? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 {BgpPeerStatusListResult} - 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. + * + * {BgpPeerStatusListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BgpPeerStatusListResult} 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. + */ + getBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { peer? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + getBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + getBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, options: { peer? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a xml format representation for supported vpn devices. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + supportedVpnDevicesWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a xml format representation for supported vpn devices. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + supportedVpnDevices(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + supportedVpnDevices(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + supportedVpnDevices(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + getLearnedRoutesWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {GatewayRouteListResult} - 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. + * + * {GatewayRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link GatewayRouteListResult} 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. + */ + getLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + getLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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. + */ + getAdvertisedRoutesWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 {GatewayRouteListResult} - 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. + * + * {GatewayRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link GatewayRouteListResult} 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. + */ + getAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, callback: ServiceCallback): void; + getAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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. + */ + setVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 {VpnClientIPsecParameters} - 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. + * + * {VpnClientIPsecParameters} [result] - The deserialized result object if an error did not occur. + * See {@link VpnClientIPsecParameters} 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. + */ + setVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + setVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, callback: ServiceCallback): void; + setVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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. + */ + getVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 {VpnClientIPsecParameters} - 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. + * + * {VpnClientIPsecParameters} [result] - The deserialized result object if an error did not occur. + * See {@link VpnClientIPsecParameters} 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. + */ + getVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + getVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets a xml format representation for vpn device configuration script. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection for which the configuration script is generated. + * + * @param {object} parameters Parameters supplied to the generate vpn device + * script operation. + * + * @param {string} [parameters.vendor] The vendor for the vpn device. + * + * @param {string} [parameters.deviceFamily] The device family for the vpn + * device. + * + * @param {string} [parameters.firmwareVersion] The firmware version for the + * vpn device. + * + * @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. + */ + vpnDeviceConfigurationScriptWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VpnDeviceScriptParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets a xml format representation for vpn device configuration script. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection for which the configuration script is generated. + * + * @param {object} parameters Parameters supplied to the generate vpn device + * script operation. + * + * @param {string} [parameters.vendor] The vendor for the vpn device. + * + * @param {string} [parameters.deviceFamily] The device family for the vpn + * device. + * + * @param {string} [parameters.firmwareVersion] The firmware version for the + * vpn device. + * + * @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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + vpnDeviceConfigurationScript(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VpnDeviceScriptParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + vpnDeviceConfigurationScript(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VpnDeviceScriptParameters, callback: ServiceCallback): void; + vpnDeviceConfigurationScript(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VpnDeviceScriptParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VirtualNetworkGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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. + */ + beginResetWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 {VirtualNetworkGateway} - 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. + * + * {VirtualNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} 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. + */ + beginReset(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginReset(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginReset(resourceGroupName: string, virtualNetworkGatewayName: string, options: { gatewayVip? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + beginGeneratevpnclientpackageWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginGeneratevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGeneratevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, callback: ServiceCallback): void; + beginGeneratevpnclientpackage(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + beginGenerateVpnProfileWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginGenerateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGenerateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, callback: ServiceCallback): void; + beginGenerateVpnProfile(resourceGroupName: string, virtualNetworkGatewayName: string, parameters: models.VpnClientParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + beginGetVpnProfilePackageUrlWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {String} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginGetVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginGetVpnProfilePackageUrl(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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. + */ + beginGetBgpPeerStatusWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { peer? : string, customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 {BgpPeerStatusListResult} - 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. + * + * {BgpPeerStatusListResult} [result] - The deserialized result object if an error did not occur. + * See {@link BgpPeerStatusListResult} 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. + */ + beginGetBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { peer? : string, customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginGetBgpPeerStatus(resourceGroupName: string, virtualNetworkGatewayName: string, options: { peer? : string, customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + beginGetLearnedRoutesWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {GatewayRouteListResult} - 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. + * + * {GatewayRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link GatewayRouteListResult} 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. + */ + beginGetLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginGetLearnedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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. + */ + beginGetAdvertisedRoutesWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 {GatewayRouteListResult} - 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. + * + * {GatewayRouteListResult} [result] - The deserialized result object if an error did not occur. + * See {@link GatewayRouteListResult} 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. + */ + beginGetAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, callback: ServiceCallback): void; + beginGetAdvertisedRoutes(resourceGroupName: string, virtualNetworkGatewayName: string, peer: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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. + */ + beginSetVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 {VpnClientIPsecParameters} - 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. + * + * {VpnClientIPsecParameters} [result] - The deserialized result object if an error did not occur. + * See {@link VpnClientIPsecParameters} 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. + */ + beginSetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginSetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, callback: ServiceCallback): void; + beginSetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, vpnclientIpsecParams: models.VpnClientIPsecParameters, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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. + */ + beginGetVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 {VpnClientIPsecParameters} - 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. + * + * {VpnClientIPsecParameters} [result] - The deserialized result object if an error did not occur. + * See {@link VpnClientIPsecParameters} 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. + */ + beginGetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginGetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, callback: ServiceCallback): void; + beginGetVpnclientIpsecParameters(resourceGroupName: string, virtualNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayListResult} - 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. + * + * {VirtualNetworkGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listConnectionsNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayListConnectionsResult} - 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. + * + * {VirtualNetworkGatewayListConnectionsResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListConnectionsResult} + * 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. + */ + listConnectionsNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listConnectionsNext(nextPageLink: string, callback: ServiceCallback): void; + listConnectionsNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * VirtualNetworkGatewayConnections + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface VirtualNetworkGatewayConnections { + + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetworkGatewayConnection} - 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. + * + * {VirtualNetworkGatewayConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified virtual network gateway connection by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified virtual network gateway connection by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayConnection} - 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. + * + * {VirtualNetworkGatewayConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayConnectionListEntity} - 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. + * + * {VirtualNetworkGatewayConnectionListEntity} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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. + */ + setSharedKeyWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 {ConnectionSharedKey} - 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. + * + * {ConnectionSharedKey} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionSharedKey} 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. + */ + setSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + setSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, callback: ServiceCallback): void; + setSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves + * information about the specified virtual network gateway connection shared + * key through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection shared key name. + * + * @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. + */ + getSharedKeyWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves + * information about the specified virtual network gateway connection shared + * key through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection shared key name. + * + * @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 {ConnectionSharedKey} - 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. + * + * {ConnectionSharedKey} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionSharedKey} 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. + */ + getSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + getSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, callback: ServiceCallback): void; + getSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayConnectionListResult} - 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. + * + * {VirtualNetworkGatewayConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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. + */ + resetSharedKeyWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 {ConnectionResetSharedKey} - 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. + * + * {ConnectionResetSharedKey} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionResetSharedKey} 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. + */ + resetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + resetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, callback: ServiceCallback): void; + resetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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 {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 {VirtualNetworkGatewayConnection} - 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. + * + * {VirtualNetworkGatewayConnection} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.VirtualNetworkGatewayConnection, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {VirtualNetworkGatewayConnectionListEntity} - 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. + * + * {VirtualNetworkGatewayConnectionListEntity} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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. + */ + beginSetSharedKeyWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 {ConnectionSharedKey} - 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. + * + * {ConnectionSharedKey} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionSharedKey} 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. + */ + beginSetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginSetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, callback: ServiceCallback): void; + beginSetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionSharedKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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. + */ + beginResetSharedKeyWithHttpOperationResponse(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 {ConnectionResetSharedKey} - 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. + * + * {ConnectionResetSharedKey} [result] - The deserialized result object if an error did not occur. + * See {@link ConnectionResetSharedKey} 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. + */ + beginResetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginResetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, callback: ServiceCallback): void; + beginResetSharedKey(resourceGroupName: string, virtualNetworkGatewayConnectionName: string, parameters: models.ConnectionResetSharedKey, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @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 {VirtualNetworkGatewayConnectionListResult} - 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. + * + * {VirtualNetworkGatewayConnectionListResult} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} + +/** + * @class + * LocalNetworkGateways + * __NOTE__: An instance of this class is automatically created for an + * instance of the NetworkManagementClient. + */ +export interface LocalNetworkGateways { + + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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|ServiceError} - The error object. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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 {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 {LocalNetworkGateway} - 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. + * + * {LocalNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + createOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, callback: ServiceCallback): void; + createOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets the specified local network gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets the specified local network gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * 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 {LocalNetworkGateway} - 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. + * + * {LocalNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + get(resourceGroupName: string, localNetworkGatewayName: string, callback: ServiceCallback): void; + get(resourceGroupName: string, localNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + deleteMethod(resourceGroupName: string, localNetworkGatewayName: string, callback: ServiceCallback): void; + deleteMethod(resourceGroupName: string, localNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LocalNetworkGateway} - 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. + * + * {LocalNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + updateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + updateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LocalNetworkGatewayListResult} - 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. + * + * {LocalNetworkGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + list(resourceGroupName: string, callback: ServiceCallback): void; + list(resourceGroupName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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|ServiceError} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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 {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 {LocalNetworkGateway} - 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. + * + * {LocalNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginCreateOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, callback: ServiceCallback): void; + beginCreateOrUpdate(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.LocalNetworkGateway, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + * + * {ServiceCallback} optionalCallback(err, result, request, response) + * + * {Error|ServiceError} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName: string, localNetworkGatewayName: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginDeleteMethod(resourceGroupName: string, localNetworkGatewayName: string, callback: ServiceCallback): void; + beginDeleteMethod(resourceGroupName: string, localNetworkGatewayName: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LocalNetworkGateway} - 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. + * + * {LocalNetworkGateway} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + beginUpdateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, callback: ServiceCallback): void; + beginUpdateTags(resourceGroupName: string, localNetworkGatewayName: string, parameters: models.TagsObject, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; + + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error|ServiceError} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise>; + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {ServiceCallback} [optionalCallback] - The optional callback. + * + * @returns {ServiceCallback|Promise} If a callback was passed as the last + * parameter then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned. + * + * @resolve {LocalNetworkGatewayListResult} - 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. + * + * {LocalNetworkGatewayListResult} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGatewayListResult} for more + * information. + * + * {WebResource} [request] - The HTTP Request object if an error did not occur. + * + * {http.IncomingMessage} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink: string, options?: { customHeaders? : { [headerName: string]: string; } }): Promise; + listNext(nextPageLink: string, callback: ServiceCallback): void; + listNext(nextPageLink: string, options: { customHeaders? : { [headerName: string]: string; } }, callback: ServiceCallback): void; +} diff --git a/lib/services/networkManagement2/lib/lib/operations/index.js b/lib/services/networkManagement2/lib/lib/operations/index.js new file mode 100644 index 0000000000..b71044c90d --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/index.js @@ -0,0 +1,57 @@ +/* + * 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. + */ + +/* jshint latedef:false */ +/* jshint forin:false */ +/* jshint noempty:false */ + +'use strict'; + +exports.ApplicationGateways = require('./applicationGateways'); +exports.ApplicationSecurityGroups = require('./applicationSecurityGroups'); +exports.DdosProtectionPlans = require('./ddosProtectionPlans'); +exports.AvailableEndpointServices = require('./availableEndpointServices'); +exports.ExpressRouteCircuitAuthorizations = require('./expressRouteCircuitAuthorizations'); +exports.ExpressRouteCircuitPeerings = require('./expressRouteCircuitPeerings'); +exports.ExpressRouteCircuitConnections = require('./expressRouteCircuitConnections'); +exports.ExpressRouteCircuits = require('./expressRouteCircuits'); +exports.ExpressRouteServiceProviders = require('./expressRouteServiceProviders'); +exports.ExpressRouteCrossConnections = require('./expressRouteCrossConnections'); +exports.ExpressRouteCrossConnectionPeerings = require('./expressRouteCrossConnectionPeerings'); +exports.LoadBalancers = require('./loadBalancers'); +exports.LoadBalancerBackendAddressPools = require('./loadBalancerBackendAddressPools'); +exports.LoadBalancerFrontendIPConfigurations = require('./loadBalancerFrontendIPConfigurations'); +exports.InboundNatRules = require('./inboundNatRules'); +exports.LoadBalancerLoadBalancingRules = require('./loadBalancerLoadBalancingRules'); +exports.LoadBalancerNetworkInterfaces = require('./loadBalancerNetworkInterfaces'); +exports.LoadBalancerProbes = require('./loadBalancerProbes'); +exports.NetworkInterfaces = require('./networkInterfaces'); +exports.NetworkInterfaceIPConfigurations = require('./networkInterfaceIPConfigurations'); +exports.NetworkInterfaceLoadBalancers = require('./networkInterfaceLoadBalancers'); +exports.NetworkSecurityGroups = require('./networkSecurityGroups'); +exports.SecurityRules = require('./securityRules'); +exports.DefaultSecurityRules = require('./defaultSecurityRules'); +exports.NetworkWatchers = require('./networkWatchers'); +exports.PacketCaptures = require('./packetCaptures'); +exports.ConnectionMonitors = require('./connectionMonitors'); +exports.Operations = require('./operations'); +exports.PublicIPAddresses = require('./publicIPAddresses'); +exports.RouteFilters = require('./routeFilters'); +exports.RouteFilterRules = require('./routeFilterRules'); +exports.RouteTables = require('./routeTables'); +exports.Routes = require('./routes'); +exports.BgpServiceCommunities = require('./bgpServiceCommunities'); +exports.Usages = require('./usages'); +exports.VirtualNetworks = require('./virtualNetworks'); +exports.Subnets = require('./subnets'); +exports.VirtualNetworkPeerings = require('./virtualNetworkPeerings'); +exports.VirtualNetworkGateways = require('./virtualNetworkGateways'); +exports.VirtualNetworkGatewayConnections = require('./virtualNetworkGatewayConnections'); +exports.LocalNetworkGateways = require('./localNetworkGateways'); diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancerBackendAddressPools.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancerBackendAddressPools.js new file mode 100644 index 0000000000..48c39799aa --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancerBackendAddressPools.js @@ -0,0 +1,719 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the load balancer backed address pools. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerBackendAddressPoolListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets load balancer backend address pool. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} backendAddressPoolName The name of the backend address pool. + * + * @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 BackendAddressPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, backendAddressPoolName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (backendAddressPoolName === null || backendAddressPoolName === undefined || typeof backendAddressPoolName.valueOf() !== 'string') { + throw new Error('backendAddressPoolName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{backendAddressPoolName}', encodeURIComponent(backendAddressPoolName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['BackendAddressPool']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancer backed address pools. + * + * @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 LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerBackendAddressPoolListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancerBackendAddressPools. */ +class LoadBalancerBackendAddressPools { + /** + * Create a LoadBalancerBackendAddressPools. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerBackendAddressPoolListResult} - 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 LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets load balancer backend address pool. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} backendAddressPoolName The name of the backend address pool. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, backendAddressPoolName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, backendAddressPoolName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets load balancer backend address pool. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} backendAddressPoolName The name of the backend address pool. + * + * @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 {BackendAddressPool} - 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 BackendAddressPool} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, backendAddressPoolName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, backendAddressPoolName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, backendAddressPoolName, options, optionalCallback); + } + } + + /** + * Gets all the load balancer backed address pools. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer backed address pools. + * + * @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 {LoadBalancerBackendAddressPoolListResult} - 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 LoadBalancerBackendAddressPoolListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancerBackendAddressPools; diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancerFrontendIPConfigurations.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancerFrontendIPConfigurations.js new file mode 100644 index 0000000000..fd396ac90b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancerFrontendIPConfigurations.js @@ -0,0 +1,728 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerFrontendIPConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets load balancer frontend IP configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} frontendIPConfigurationName The name of the frontend IP + * configuration. + * + * @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 FrontendIPConfiguration} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, frontendIPConfigurationName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (frontendIPConfigurationName === null || frontendIPConfigurationName === undefined || typeof frontendIPConfigurationName.valueOf() !== 'string') { + throw new Error('frontendIPConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{frontendIPConfigurationName}', encodeURIComponent(frontendIPConfigurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['FrontendIPConfiguration']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancer frontend IP configurations. + * + * @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 + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerFrontendIPConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancerFrontendIPConfigurations. */ +class LoadBalancerFrontendIPConfigurations { + /** + * Create a LoadBalancerFrontendIPConfigurations. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerFrontendIPConfigurationListResult} - 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 + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets load balancer frontend IP configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} frontendIPConfigurationName The name of the frontend IP + * configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, frontendIPConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, frontendIPConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets load balancer frontend IP configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} frontendIPConfigurationName The name of the frontend IP + * configuration. + * + * @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 {FrontendIPConfiguration} - 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 FrontendIPConfiguration} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, frontendIPConfigurationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, frontendIPConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, frontendIPConfigurationName, options, optionalCallback); + } + } + + /** + * Gets all the load balancer frontend IP configurations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer frontend IP configurations. + * + * @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 {LoadBalancerFrontendIPConfigurationListResult} - 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 + * LoadBalancerFrontendIPConfigurationListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancerFrontendIPConfigurations; diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancerLoadBalancingRules.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancerLoadBalancingRules.js new file mode 100644 index 0000000000..40590cf2c2 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancerLoadBalancingRules.js @@ -0,0 +1,719 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerLoadBalancingRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the specified load balancer load balancing rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} loadBalancingRuleName The name of the load balancing rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, loadBalancingRuleName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancingRuleName === null || loadBalancingRuleName === undefined || typeof loadBalancingRuleName.valueOf() !== 'string') { + throw new Error('loadBalancingRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{loadBalancingRuleName}', encodeURIComponent(loadBalancingRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancingRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerLoadBalancingRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancerLoadBalancingRules. */ +class LoadBalancerLoadBalancingRules { + /** + * Create a LoadBalancerLoadBalancingRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerLoadBalancingRuleListResult} - 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 LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets the specified load balancer load balancing rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} loadBalancingRuleName The name of the load balancing rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, loadBalancingRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, loadBalancingRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified load balancer load balancing rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} loadBalancingRuleName The name of the load balancing rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancingRule} - 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 LoadBalancingRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, loadBalancingRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, loadBalancingRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, loadBalancingRuleName, options, optionalCallback); + } + } + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancing rules in a load balancer. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerLoadBalancingRuleListResult} - 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 LoadBalancerLoadBalancingRuleListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancerLoadBalancingRules; diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancerNetworkInterfaces.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancerNetworkInterfaces.js new file mode 100644 index 0000000000..543a490d40 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancerNetworkInterfaces.js @@ -0,0 +1,477 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets associated load balancer network interfaces. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets associated load balancer network interfaces. + * + * @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 NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancerNetworkInterfaces. */ +class LoadBalancerNetworkInterfaces { + /** + * Create a LoadBalancerNetworkInterfaces. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets associated load balancer network interfaces. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets associated load balancer network interfaces. + * + * @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 {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancerNetworkInterfaces; diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancerProbes.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancerProbes.js new file mode 100644 index 0000000000..4f03ac9afc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancerProbes.js @@ -0,0 +1,719 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Gets all the load balancer probes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerProbeListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerProbeListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets load balancer probe. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} probeName The name of the probe. + * + * @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 Probe} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, probeName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (probeName === null || probeName === undefined || typeof probeName.valueOf() !== 'string') { + throw new Error('probeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{probeName}', encodeURIComponent(probeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Probe']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancer probes. + * + * @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 LoadBalancerProbeListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerProbeListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancerProbes. */ +class LoadBalancerProbes { + /** + * Create a LoadBalancerProbes. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Gets all the load balancer probes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer probes. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerProbeListResult} - 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 LoadBalancerProbeListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets load balancer probe. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} probeName The name of the probe. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, probeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, probeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets load balancer probe. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {string} probeName The name of the probe. + * + * @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 {Probe} - 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 Probe} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, probeName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, probeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, probeName, options, optionalCallback); + } + } + + /** + * Gets all the load balancer probes. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancer probes. + * + * @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 {LoadBalancerProbeListResult} - 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 LoadBalancerProbeListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancerProbes; diff --git a/lib/services/networkManagement2/lib/lib/operations/loadBalancers.js b/lib/services/networkManagement2/lib/lib/operations/loadBalancers.js new file mode 100644 index 0000000000..8bd21d2254 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/loadBalancers.js @@ -0,0 +1,2701 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, loadBalancerName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, loadBalancerName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, loadBalancerName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, loadBalancerName, 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['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, loadBalancerName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, loadBalancerName, 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['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all the load balancers in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancers in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerListResult']().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 load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, loadBalancerName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, loadBalancerName, 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.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['LoadBalancer']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, loadBalancerName, 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.'); + } + // Validate + try { + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (loadBalancerName === null || loadBalancerName === undefined || typeof loadBalancerName.valueOf() !== 'string') { + throw new Error('loadBalancerName cannot be null or undefined and it must be of type string.'); + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{loadBalancerName}', encodeURIComponent(loadBalancerName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancer']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancers in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the load balancers in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LoadBalancerListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LoadBalancerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LoadBalancers. */ +class LoadBalancers { + /** + * Create a LoadBalancers. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listAll = _listAll; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + } + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Gets the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {LoadBalancer} - 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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, loadBalancerName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, loadBalancerName, 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 load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {LoadBalancer} - 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, loadBalancerName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, loadBalancerName, parameters, options, optionalCallback); + } + } + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, loadBalancerName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancer} - 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, loadBalancerName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, loadBalancerName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the load balancers in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancers in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerListResult} - 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 LoadBalancerListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerListResult} - 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 LoadBalancerListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, loadBalancerName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, loadBalancerName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, loadBalancerName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, loadBalancerName, options, optionalCallback); + } + } + + /** + * Creates or updates a load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, loadBalancerName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, 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 load balancer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to the create or update load + * balancer operation. + * + * @param {object} [parameters.sku] The load balancer SKU. + * + * @param {string} [parameters.sku.name] Name of a load balancer SKU. Possible + * values include: 'Basic', 'Standard' + * + * @param {array} [parameters.frontendIPConfigurations] Object representing the + * frontend IPs to be used for the load balancer + * + * @param {array} [parameters.backendAddressPools] Collection of backend + * address pools used by a load balancer + * + * @param {array} [parameters.loadBalancingRules] Object collection + * representing the load balancing rules Gets the provisioning + * + * @param {array} [parameters.probes] Collection of probe objects used in the + * load balancer + * + * @param {array} [parameters.inboundNatRules] Collection of inbound NAT Rules + * used by a load balancer. Defining inbound NAT rules on your load balancer is + * mutually exclusive with defining an inbound NAT pool. Inbound NAT pools are + * referenced from virtual machine scale sets. NICs that are associated with + * individual virtual machines cannot reference an Inbound NAT pool. They have + * to reference individual inbound NAT rules. + * + * @param {array} [parameters.inboundNatPools] Defines an external port range + * for inbound NAT to a single backend port on NICs associated with a load + * balancer. Inbound NAT rules are created automatically for each NIC + * associated with the Load Balancer using an external port from this range. + * Defining an Inbound NAT pool on your Load Balancer is mutually exclusive + * with defining inbound Nat rules. Inbound NAT pools are referenced from + * virtual machine scale sets. NICs that are associated with individual virtual + * machines cannot reference an inbound NAT pool. They have to reference + * individual inbound NAT rules. + * + * @param {array} [parameters.outboundNatRules] The outbound NAT rules. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * load balancer resource. + * + * @param {string} [parameters.provisioningState] Gets the provisioning state + * of the PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {LoadBalancer} - 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, loadBalancerName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, loadBalancerName, parameters, options, optionalCallback); + } + } + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, loadBalancerName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a load balancer tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} loadBalancerName The name of the load balancer. + * + * @param {object} parameters Parameters supplied to update load balancer tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancer} - 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 LoadBalancer} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, loadBalancerName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, loadBalancerName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, loadBalancerName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the load balancers in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancers in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerListResult} - 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 LoadBalancerListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the load balancers in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LoadBalancerListResult} - 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 LoadBalancerListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LoadBalancers; diff --git a/lib/services/networkManagement2/lib/lib/operations/localNetworkGateways.js b/lib/services/networkManagement2/lib/lib/operations/localNetworkGateways.js new file mode 100644 index 0000000000..9d43427a97 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/localNetworkGateways.js @@ -0,0 +1,2191 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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} 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, 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['LocalNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified local network gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, localNetworkGatewayName, 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 (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 (localNetworkGatewayName === null || localNetworkGatewayName === undefined || typeof localNetworkGatewayName.valueOf() !== 'string') { + throw new Error('localNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (localNetworkGatewayName !== null && localNetworkGatewayName !== undefined) { + if (localNetworkGatewayName.length < 1) + { + throw new Error('"localNetworkGatewayName" should satisfy the constraint - "MinLength": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{localNetworkGatewayName}', encodeURIComponent(localNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGateway']().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 local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, localNetworkGatewayName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, localNetworkGatewayName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, localNetworkGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, localNetworkGatewayName, 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['LocalNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all the local network gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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} 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, 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.'); + } + // 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 (localNetworkGatewayName === null || localNetworkGatewayName === undefined || typeof localNetworkGatewayName.valueOf() !== 'string') { + throw new Error('localNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (localNetworkGatewayName !== null && localNetworkGatewayName !== undefined) { + if (localNetworkGatewayName.length < 1) + { + throw new Error('"localNetworkGatewayName" should satisfy the constraint - "MinLength": 1'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{localNetworkGatewayName}', encodeURIComponent(localNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['LocalNetworkGateway']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, localNetworkGatewayName, 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 (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 (localNetworkGatewayName === null || localNetworkGatewayName === undefined || typeof localNetworkGatewayName.valueOf() !== 'string') { + throw new Error('localNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (localNetworkGatewayName !== null && localNetworkGatewayName !== undefined) { + if (localNetworkGatewayName.length < 1) + { + throw new Error('"localNetworkGatewayName" should satisfy the constraint - "MinLength": 1'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{localNetworkGatewayName}', encodeURIComponent(localNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, localNetworkGatewayName, 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.'); + } + // 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 (localNetworkGatewayName === null || localNetworkGatewayName === undefined || typeof localNetworkGatewayName.valueOf() !== 'string') { + throw new Error('localNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (localNetworkGatewayName !== null && localNetworkGatewayName !== undefined) { + if (localNetworkGatewayName.length < 1) + { + throw new Error('"localNetworkGatewayName" should satisfy the constraint - "MinLength": 1'); + } + } + if (parameters === null || parameters === undefined) { + throw new Error('parameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{localNetworkGatewayName}', encodeURIComponent(localNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the local network gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link LocalNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['LocalNetworkGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a LocalNetworkGateways. */ +class LocalNetworkGateways { + /** + * Create a LocalNetworkGateways. + * @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._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdateTags = _beginUpdateTags; + this._listNext = _listNext; + } + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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, localNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, localNetworkGatewayName, 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 local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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 {LocalNetworkGateway} - 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets the specified local network gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified local network gateway in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * 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 {LocalNetworkGateway} - 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, localNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, localNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, localNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, localNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LocalNetworkGateway} - 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LocalNetworkGatewayListResult} - 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 LocalNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, 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 local network gateway in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to the create or update local + * network gateway operation. + * + * @param {object} [parameters.localNetworkAddressSpace] Local network site + * address space. + * + * @param {array} [parameters.localNetworkAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.gatewayIpAddress] IP address of local network + * gateway. + * + * @param {object} [parameters.bgpSettings] Local network gateway's BGP speaker + * settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * LocalNetworkGateway 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 {LocalNetworkGateway} - 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified local network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, localNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, localNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, localNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, localNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a local network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} localNetworkGatewayName The name of the local network + * gateway. + * + * @param {object} parameters Parameters supplied to update local network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LocalNetworkGateway} - 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 LocalNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, localNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, localNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the local network gateways in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {LocalNetworkGatewayListResult} - 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 LocalNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = LocalNetworkGateways; diff --git a/lib/services/networkManagement2/lib/lib/operations/networkInterfaceIPConfigurations.js b/lib/services/networkManagement2/lib/lib/operations/networkInterfaceIPConfigurations.js new file mode 100644 index 0000000000..db53f4db14 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/networkInterfaceIPConfigurations.js @@ -0,0 +1,721 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Get all ip configurations in a network interface + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkInterfaceName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the specified network interface ip configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration name. + * + * @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 NetworkInterfaceIPConfiguration} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkInterfaceName, ipConfigurationName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (ipConfigurationName === null || ipConfigurationName === undefined || typeof ipConfigurationName.valueOf() !== 'string') { + throw new Error('ipConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{ipConfigurationName}', encodeURIComponent(ipConfigurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfiguration']().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); + }); +} + +/** + * Get all ip configurations in a network interface + * + * @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 NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a NetworkInterfaceIPConfigurations. */ +class NetworkInterfaceIPConfigurations { + /** + * Create a NetworkInterfaceIPConfigurations. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._get = _get; + this._listNext = _listNext; + } + + /** + * Get all ip configurations in a network interface + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all ip configurations in a network interface + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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 NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkInterfaceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets the specified network interface ip configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration name. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkInterfaceName, ipConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified network interface ip configuration. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration name. + * + * @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 {NetworkInterfaceIPConfiguration} - 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 NetworkInterfaceIPConfiguration} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkInterfaceName, ipConfigurationName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkInterfaceName, ipConfigurationName, options, optionalCallback); + } + } + + /** + * Get all ip configurations in a network interface + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get all ip configurations in a network interface + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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 NetworkInterfaceIPConfigurationListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = NetworkInterfaceIPConfigurations; diff --git a/lib/services/networkManagement2/lib/lib/operations/networkInterfaceLoadBalancers.js b/lib/services/networkManagement2/lib/lib/operations/networkInterfaceLoadBalancers.js new file mode 100644 index 0000000000..db1e16ac06 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/networkInterfaceLoadBalancers.js @@ -0,0 +1,477 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List all load balancers in a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkInterfaceName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceLoadBalancerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List all load balancers in a network interface. + * + * @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 NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceLoadBalancerListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a NetworkInterfaceLoadBalancers. */ +class NetworkInterfaceLoadBalancers { + /** + * Create a NetworkInterfaceLoadBalancers. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * List all load balancers in a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all load balancers in a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {NetworkInterfaceLoadBalancerListResult} - 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 NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkInterfaceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * List all load balancers in a network interface. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List all load balancers in a network interface. + * + * @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 {NetworkInterfaceLoadBalancerListResult} - 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 NetworkInterfaceLoadBalancerListResult} for + * more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = NetworkInterfaceLoadBalancers; diff --git a/lib/services/networkManagement2/lib/lib/operations/networkInterfaces.js b/lib/services/networkManagement2/lib/lib/operations/networkInterfaces.js new file mode 100644 index 0000000000..c24fdf2233 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/networkInterfaces.js @@ -0,0 +1,5674 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkInterfaceName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkInterfaceName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets information about the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkInterfaceName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/networkInterfaces/{networkInterfaceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, networkInterfaceName, 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['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, networkInterfaceName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, networkInterfaceName, 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['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all network interfaces in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network interfaces in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 EffectiveRouteListResult} 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 _getEffectiveRouteTable(resourceGroupName, networkInterfaceName, 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.beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, 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['EffectiveRouteListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 EffectiveNetworkSecurityGroupListResult} 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 _listEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, 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.beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, 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['EffectiveNetworkSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @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 NetworkInterfaceListResult} 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 _listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, 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-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network interfaces in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 NetworkInterfaceListResult} 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 _listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, 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-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().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); + }); +} + +/** + * Get the specified network interface in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 NetworkInterface} 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 _getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + let apiVersion = '2018-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterface']().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); + }); +} + +/** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 NetworkInterfaceIPConfigurationListResult} + * 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 _listVirtualMachineScaleSetIpConfigurations(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + let apiVersion = '2018-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfigurationListResult']().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); + }); +} + +/** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 NetworkInterfaceIPConfiguration} 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 _getVirtualMachineScaleSetIpConfiguration(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + let apiVersion = '2018-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (ipConfigurationName === null || ipConfigurationName === undefined || typeof ipConfigurationName.valueOf() !== 'string') { + throw new Error('ipConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{ipConfigurationName}', encodeURIComponent(ipConfigurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfiguration']().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 interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkInterfaceName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, networkInterfaceName, 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.'); + } + // 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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['NetworkInterface']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, networkInterfaceName, 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.'); + } + // 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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterface']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 EffectiveRouteListResult} 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 _beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['EffectiveRouteListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 EffectiveNetworkSecurityGroupListResult} 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 _beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, 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 (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 (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['EffectiveNetworkSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network interfaces in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network interfaces in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @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 NetworkInterfaceListResult} 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 _listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network interfaces in a virtual machine scale set. + * + * @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 NetworkInterfaceListResult} 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 _listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceListResult']().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); + }); +} + +/** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @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 NetworkInterfaceIPConfigurationListResult} + * 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 _listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkInterfaceIPConfigurationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a NetworkInterfaces. */ +class NetworkInterfaces { + /** + * Create a NetworkInterfaces. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listAll = _listAll; + this._list = _list; + this._getEffectiveRouteTable = _getEffectiveRouteTable; + this._listEffectiveNetworkSecurityGroups = _listEffectiveNetworkSecurityGroups; + this._listVirtualMachineScaleSetVMNetworkInterfaces = _listVirtualMachineScaleSetVMNetworkInterfaces; + this._listVirtualMachineScaleSetNetworkInterfaces = _listVirtualMachineScaleSetNetworkInterfaces; + this._getVirtualMachineScaleSetNetworkInterface = _getVirtualMachineScaleSetNetworkInterface; + this._listVirtualMachineScaleSetIpConfigurations = _listVirtualMachineScaleSetIpConfigurations; + this._getVirtualMachineScaleSetIpConfiguration = _getVirtualMachineScaleSetIpConfiguration; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._beginGetEffectiveRouteTable = _beginGetEffectiveRouteTable; + this._beginListEffectiveNetworkSecurityGroups = _beginListEffectiveNetworkSecurityGroups; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + this._listVirtualMachineScaleSetVMNetworkInterfacesNext = _listVirtualMachineScaleSetVMNetworkInterfacesNext; + this._listVirtualMachineScaleSetNetworkInterfacesNext = _listVirtualMachineScaleSetNetworkInterfacesNext; + this._listVirtualMachineScaleSetIpConfigurationsNext = _listVirtualMachineScaleSetIpConfigurationsNext; + } + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkInterfaceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets information about the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterface} - 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkInterfaceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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, networkInterfaceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkInterfaceName, 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 interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {NetworkInterface} - 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback); + } + } + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, networkInterfaceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterface} - 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + getEffectiveRouteTableWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveRouteListResult} - 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 EffectiveRouteListResult} 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. + */ + getEffectiveRouteTable(resourceGroupName, networkInterfaceName, 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._getEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + listEffectiveNetworkSecurityGroupsWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveNetworkSecurityGroupListResult} - 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 EffectiveNetworkSecurityGroupListResult} 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. + */ + listEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, 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._listEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @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 {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, 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._listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetVMNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetNetworkInterfacesWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, 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._listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetNetworkInterfaces(resourceGroupName, virtualMachineScaleSetName, options, optionalCallback); + } + } + + /** + * Get the specified network interface in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetNetworkInterfaceWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified network interface in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterface} - 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 NetworkInterface} 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. + */ + getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, 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._getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + listVirtualMachineScaleSetIpConfigurationsWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetIpConfigurations(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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 NetworkInterfaceIPConfigurationListResult} + * 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. + */ + listVirtualMachineScaleSetIpConfigurations(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, 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._listVirtualMachineScaleSetIpConfigurations(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetIpConfigurations(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetIpConfigurationWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVirtualMachineScaleSetIpConfiguration(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the ip configuration. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkInterfaceIPConfiguration} - 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 NetworkInterfaceIPConfiguration} 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. + */ + getVirtualMachineScaleSetIpConfiguration(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, 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._getVirtualMachineScaleSetIpConfiguration(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVirtualMachineScaleSetIpConfiguration(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, optionalCallback); + } + } + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkInterfaceName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Creates or updates a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, networkInterfaceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkInterfaceName, 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 interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to the create or update + * network interface operation. + * + * @param {object} [parameters.virtualMachine] The reference of a virtual + * machine. + * + * @param {string} [parameters.virtualMachine.id] Resource ID. + * + * @param {object} [parameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [parameters.networkSecurityGroup.securityRules] A collection + * of security rules of the network security group. + * + * @param {array} [parameters.networkSecurityGroup.defaultSecurityRules] The + * default security rules of network security group. + * + * @param {string} [parameters.networkSecurityGroup.resourceGuid] The resource + * GUID property of the network security group resource. + * + * @param {string} [parameters.networkSecurityGroup.provisioningState] The + * provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.networkSecurityGroup.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [parameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [parameters.networkSecurityGroup.tags] Resource tags. + * + * @param {array} [parameters.ipConfigurations] A list of IPConfigurations of + * the network interface. + * + * @param {object} [parameters.dnsSettings] The DNS settings in network + * interface. + * + * @param {array} [parameters.dnsSettings.dnsServers] List of DNS servers IP + * addresses. Use 'AzureProvidedDNS' to switch to azure provided DNS + * resolution. 'AzureProvidedDNS' value cannot be combined with other IPs, it + * must be the only value in dnsServers collection. + * + * @param {array} [parameters.dnsSettings.appliedDnsServers] If the VM that + * uses this NIC is part of an Availability Set, then this list will have the + * union of all DNS servers from all NICs that are part of the Availability + * Set. This property is what is configured on each of those VMs. + * + * @param {string} [parameters.dnsSettings.internalDnsNameLabel] Relative DNS + * name for this NIC used for internal communications between VMs in the same + * virtual network. + * + * @param {string} [parameters.dnsSettings.internalFqdn] Fully qualified DNS + * name supporting internal communications between VMs in the same virtual + * network. + * + * @param {string} [parameters.dnsSettings.internalDomainNameSuffix] Even if + * internalDnsNameLabel is not specified, a DNS entry is created for the + * primary NIC of the VM. This DNS name can be constructed by concatenating the + * VM name with the value of internalDomainNameSuffix. + * + * @param {string} [parameters.macAddress] The MAC address of the network + * interface. + * + * @param {boolean} [parameters.primary] Gets whether this is a primary network + * interface on a virtual machine. + * + * @param {boolean} [parameters.enableAcceleratedNetworking] If the network + * interface is accelerated networking enabled. + * + * @param {boolean} [parameters.enableIPForwarding] Indicates whether IP + * forwarding is enabled on this network interface. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network interface resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {NetworkInterface} - 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback); + } + } + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, networkInterfaceName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a network interface tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {object} parameters Parameters supplied to update network interface + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterface} - 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 NetworkInterface} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, networkInterfaceName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, networkInterfaceName, parameters, options, optionalCallback); + } + } + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + beginGetEffectiveRouteTableWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveRouteListResult} - 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 EffectiveRouteListResult} 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. + */ + beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, 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._beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetEffectiveRouteTable(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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. + */ + beginListEffectiveNetworkSecurityGroupsWithHttpOperationResponse(resourceGroupName, networkInterfaceName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups applied to a network interface. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @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 {EffectiveNetworkSecurityGroupListResult} - 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 EffectiveNetworkSecurityGroupListResult} 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. + */ + beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, 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._beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListEffectiveNetworkSecurityGroups(resourceGroupName, networkInterfaceName, options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all network interfaces in a virtual machine in a + * virtual machine scale set. + * + * @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 {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetVMNetworkInterfacesNext(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._listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetVMNetworkInterfacesNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetNetworkInterfacesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network interfaces in a virtual machine scale set. + * + * @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 {NetworkInterfaceListResult} - 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 NetworkInterfaceListResult} 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. + */ + listVirtualMachineScaleSetNetworkInterfacesNext(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._listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetNetworkInterfacesNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetIpConfigurationsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified network interface ip configuration in a virtual machine + * scale set. + * + * @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 {NetworkInterfaceIPConfigurationListResult} - 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 NetworkInterfaceIPConfigurationListResult} + * 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. + */ + listVirtualMachineScaleSetIpConfigurationsNext(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._listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetIpConfigurationsNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = NetworkInterfaces; diff --git a/lib/services/networkManagement2/lib/lib/operations/networkSecurityGroups.js b/lib/services/networkManagement2/lib/lib/operations/networkSecurityGroups.js new file mode 100644 index 0000000000..60dd20b7a6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/networkSecurityGroups.js @@ -0,0 +1,2548 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkSecurityGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkSecurityGroupName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkSecurityGroupName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/networkSecurityGroups/{networkSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, 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['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, networkSecurityGroupName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, networkSecurityGroupName, 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['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all network security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroupListResult']().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 security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkSecurityGroupName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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} 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, 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.'); + } + // 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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['NetworkSecurityGroup']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, networkSecurityGroupName, 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.'); + } + // 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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroup']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkSecurityGroupListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a NetworkSecurityGroups. */ +class NetworkSecurityGroups { + /** + * Create a NetworkSecurityGroups. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listAll = _listAll; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + } + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkSecurityGroupName, options, optionalCallback); + } + } + + /** + * Gets the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {NetworkSecurityGroup} - 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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, networkSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkSecurityGroupName, 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 security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {NetworkSecurityGroup} - 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroup} - 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Gets all network security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroupListResult} - 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 NetworkSecurityGroupListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all network security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroupListResult} - 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 NetworkSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, options, optionalCallback); + } + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, 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 security group in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to the create or update + * network security group operation. + * + * @param {array} [parameters.securityRules] A collection of security rules of + * the network security group. + * + * @param {array} [parameters.defaultSecurityRules] The default security rules + * of network security group. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * network security group resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * public IP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @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 {NetworkSecurityGroup} - 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a network security group tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} parameters Parameters supplied to update network security + * group tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroup} - 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 NetworkSecurityGroup} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, networkSecurityGroupName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, networkSecurityGroupName, parameters, options, optionalCallback); + } + } + + /** + * Gets all network security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroupListResult} - 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 NetworkSecurityGroupListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all network security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network security groups in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkSecurityGroupListResult} - 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 NetworkSecurityGroupListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = NetworkSecurityGroups; diff --git a/lib/services/networkManagement2/lib/lib/operations/networkWatchers.js b/lib/services/networkManagement2/lib/lib/operations/networkWatchers.js new file mode 100644 index 0000000000..8e0d4873fa --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/networkWatchers.js @@ -0,0 +1,7202 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * 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} 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 NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, 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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['NetworkWatcher']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcher']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcher']().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); + }); +} + +/** + * Gets the specified network watcher by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @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 NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkWatcherName, 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 (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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcher']().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. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkWatcherName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkWatcherName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Updates a network watcher tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters supplied to update network watcher + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, 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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcher']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network watchers by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcherListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcherListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all network watchers by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link NetworkWatcherListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['NetworkWatcherListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets the current network topology by 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 representation of + * topology. + * + * @param {string} [parameters.targetResourceGroupName] The name of the target + * resource group to perform topology on. + * + * @param {object} [parameters.targetVirtualNetwork] The reference of the + * Virtual Network resource. + * + * @param {object} [parameters.targetSubnet] The reference of the Subnet + * resource. + * + * @param {string} [parameters.targetSubnet.id] Resource 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 Topology} 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 _getTopology(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology'; + 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(this.client.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['TopologyParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Topology']().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); + }); +} + + +/** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 VerificationIPFlowResult} 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 _verifyIPFlow(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.beginVerifyIPFlow(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['VerificationIPFlowResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 NextHopResult} 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 _getNextHop(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.beginGetNextHop(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['NextHopResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 SecurityGroupViewResult} 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 _getVMSecurityRules(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.beginGetVMSecurityRules(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['SecurityGroupViewResult']().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); + }); + }); +} + + +/** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 TroubleshootingResult} 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 _getTroubleshooting(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.beginGetTroubleshooting(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['TroubleshootingResult']().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); + }); + }); +} + + +/** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 TroubleshootingResult} 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 _getTroubleshootingResult(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.beginGetTroubleshootingResult(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['TroubleshootingResult']().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); + }); + }); +} + + +/** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 FlowLogInformation} 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 _setFlowLogConfiguration(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.beginSetFlowLogConfiguration(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['FlowLogInformation']().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); + }); + }); +} + + +/** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 FlowLogInformation} 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 _getFlowLogStatus(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.beginGetFlowLogStatus(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['FlowLogInformation']().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); + }); + }); +} + + +/** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 ConnectivityInformation} 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 _checkConnectivity(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.beginCheckConnectivity(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['ConnectivityInformation']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 AzureReachabilityReport} 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 _getAzureReachabilityReport(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.beginGetAzureReachabilityReport(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['AzureReachabilityReport']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 AvailableProvidersList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listAvailableProviders(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.beginListAvailableProviders(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['AvailableProvidersList']().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. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkWatcherName, 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 (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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 VerificationIPFlowResult} 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 _beginVerifyIPFlow(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify'; + 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(this.client.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['VerificationIPFlowParameters']().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['VerificationIPFlowResult']().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['VerificationIPFlowResult']().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); + }); +} + +/** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 NextHopResult} 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 _beginGetNextHop(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop'; + 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(this.client.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['NextHopParameters']().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['NextHopResult']().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['NextHopResult']().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); + }); +} + +/** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 SecurityGroupViewResult} 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 _beginGetVMSecurityRules(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView'; + 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(this.client.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['SecurityGroupViewParameters']().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['SecurityGroupViewResult']().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['SecurityGroupViewResult']().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); + }); +} + +/** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 TroubleshootingResult} 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 _beginGetTroubleshooting(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot'; + 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(this.client.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['TroubleshootingParameters']().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['TroubleshootingResult']().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['TroubleshootingResult']().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); + }); +} + +/** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 TroubleshootingResult} 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 _beginGetTroubleshootingResult(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult'; + 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(this.client.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['QueryTroubleshootingParameters']().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['TroubleshootingResult']().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['TroubleshootingResult']().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); + }); +} + +/** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 FlowLogInformation} 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 _beginSetFlowLogConfiguration(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog'; + 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(this.client.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['FlowLogInformation']().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['FlowLogInformation']().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['FlowLogInformation']().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); + }); +} + +/** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 FlowLogInformation} 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 _beginGetFlowLogStatus(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus'; + 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(this.client.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['FlowLogStatusParameters']().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['FlowLogInformation']().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['FlowLogInformation']().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); + }); +} + +/** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 ConnectivityInformation} 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 _beginCheckConnectivity(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/connectivityCheck'; + 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(this.client.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['ConnectivityParameters']().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['ConnectivityInformation']().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['ConnectivityInformation']().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); + }); +} + +/** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 AzureReachabilityReport} 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 _beginGetAzureReachabilityReport(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/azureReachabilityReport'; + 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(this.client.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['AzureReachabilityReportParameters']().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['AzureReachabilityReport']().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['AzureReachabilityReport']().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); + }); +} + +/** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 AvailableProvidersList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginListAvailableProviders(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.'); + } + // 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/availableProvidersList'; + 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(this.client.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['AvailableProvidersListParameters']().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['AvailableProvidersList']().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['AvailableProvidersList']().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._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; + } + + /** + * 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. + * + * {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 NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, 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._createOrUpdate(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the specified network watcher by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkWatcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified network watcher by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @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. + * + * {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 NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkWatcherName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkWatcherName, options, optionalCallback); + } + } + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkWatcherName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkWatcherName, options, optionalCallback); + } + } + + /** + * Updates a network watcher tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters supplied to update network watcher + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(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; + }); + }); + } + + /** + * Updates a network watcher tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} parameters Parameters supplied to update network watcher + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkWatcher} - 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 NetworkWatcher} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, 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._updateTags(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets all network watchers by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network watchers by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkWatcherListResult} - 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 NetworkWatcherListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all network watchers by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all network watchers by subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {NetworkWatcherListResult} - 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 NetworkWatcherListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets the current network topology by 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 representation of + * topology. + * + * @param {string} [parameters.targetResourceGroupName] The name of the target + * resource group to perform topology on. + * + * @param {object} [parameters.targetVirtualNetwork] The reference of the + * Virtual Network resource. + * + * @param {object} [parameters.targetSubnet] The reference of the Subnet + * resource. + * + * @param {string} [parameters.targetSubnet.id] Resource 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. + */ + getTopologyWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getTopology(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; + }); + }); + } + + /** + * Gets the current network topology by 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 representation of + * topology. + * + * @param {string} [parameters.targetResourceGroupName] The name of the target + * resource group to perform topology on. + * + * @param {object} [parameters.targetVirtualNetwork] The reference of the + * Virtual Network resource. + * + * @param {object} [parameters.targetSubnet] The reference of the Subnet + * resource. + * + * @param {string} [parameters.targetSubnet.id] Resource 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 {Topology} - 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 Topology} 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. + */ + getTopology(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._getTopology(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getTopology(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + verifyIPFlowWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._verifyIPFlow(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; + }); + }); + } + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 {VerificationIPFlowResult} - 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 VerificationIPFlowResult} 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. + */ + verifyIPFlow(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._verifyIPFlow(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._verifyIPFlow(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + getNextHopWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getNextHop(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; + }); + }); + } + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 {NextHopResult} - 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 NextHopResult} 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. + */ + getNextHop(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._getNextHop(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getNextHop(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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. + */ + getVMSecurityRulesWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVMSecurityRules(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; + }); + }); + } + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 {SecurityGroupViewResult} - 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 SecurityGroupViewResult} 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. + */ + getVMSecurityRules(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._getVMSecurityRules(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVMSecurityRules(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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. + */ + getTroubleshootingWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getTroubleshooting(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; + }); + }); + } + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 {TroubleshootingResult} - 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 TroubleshootingResult} 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. + */ + getTroubleshooting(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._getTroubleshooting(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getTroubleshooting(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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. + */ + getTroubleshootingResultWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getTroubleshootingResult(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 the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 {TroubleshootingResult} - 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 TroubleshootingResult} 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. + */ + getTroubleshootingResult(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._getTroubleshootingResult(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getTroubleshootingResult(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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. + */ + setFlowLogConfigurationWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setFlowLogConfiguration(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; + }); + }); + } + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 {FlowLogInformation} - 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 FlowLogInformation} 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. + */ + setFlowLogConfiguration(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._setFlowLogConfiguration(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setFlowLogConfiguration(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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. + */ + getFlowLogStatusWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getFlowLogStatus(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; + }); + }); + } + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 {FlowLogInformation} - 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 FlowLogInformation} 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. + */ + getFlowLogStatus(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._getFlowLogStatus(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getFlowLogStatus(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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. + */ + checkConnectivityWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkConnectivity(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; + }); + }); + } + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 {ConnectivityInformation} - 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 ConnectivityInformation} 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. + */ + checkConnectivity(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._checkConnectivity(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkConnectivity(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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. + */ + getAzureReachabilityReportWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAzureReachabilityReport(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; + }); + }); + } + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 {AzureReachabilityReport} - 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 AzureReachabilityReport} 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. + */ + getAzureReachabilityReport(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._getAzureReachabilityReport(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAzureReachabilityReport(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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. + */ + listAvailableProvidersWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAvailableProviders(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; + }); + }); + } + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 {AvailableProvidersList} - 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 AvailableProvidersList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network watcher resource. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkWatcherName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkWatcherName, options, optionalCallback); + } + } + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + beginVerifyIPFlowWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginVerifyIPFlow(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; + }); + }); + } + + /** + * Verify IP flow from the specified VM to a location given the currently + * configured NSG rules. + * + * @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 IP flow to be + * verified. + * + * @param {string} parameters.targetResourceId The ID of the target resource to + * perform next-hop on. + * + * @param {string} parameters.direction The direction of the packet represented + * as a 5-tuple. Possible values include: 'Inbound', 'Outbound' + * + * @param {string} parameters.protocol Protocol to be verified on. Possible + * values include: 'TCP', 'UDP' + * + * @param {string} parameters.localPort The local port. Acceptable values are a + * single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.remotePort The remote port. Acceptable values are + * a single integer in the range (0-65535). Support for * for the source port, + * which depends on the direction. + * + * @param {string} parameters.localIPAddress The local IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} parameters.remoteIPAddress The remote IP address. Acceptable + * values are valid IPv4 addresses. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of them, then this + * parameter must be specified. Otherwise optional). + * + * @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 {VerificationIPFlowResult} - 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 VerificationIPFlowResult} 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. + */ + beginVerifyIPFlow(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._beginVerifyIPFlow(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginVerifyIPFlow(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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. + */ + beginGetNextHopWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetNextHop(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; + }); + }); + } + + /** + * Gets the next hop from the specified VM. + * + * @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 source and destination + * endpoint. + * + * @param {string} parameters.targetResourceId The resource identifier of the + * target resource against which the action is to be performed. + * + * @param {string} parameters.sourceIPAddress The source IP address. + * + * @param {string} parameters.destinationIPAddress The destination IP address. + * + * @param {string} [parameters.targetNicResourceId] The NIC ID. (If VM has + * multiple NICs and IP forwarding is enabled on any of the nics, then this + * parameter must be specified. Otherwise optional). + * + * @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 {NextHopResult} - 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 NextHopResult} 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. + */ + beginGetNextHop(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._beginGetNextHop(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetNextHop(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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. + */ + beginGetVMSecurityRulesWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetVMSecurityRules(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; + }); + }); + } + + /** + * Gets the configured and effective security group rules on the specified VM. + * + * @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 VM to check security + * groups for. + * + * @param {string} parameters.targetResourceId ID of the target VM. + * + * @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 {SecurityGroupViewResult} - 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 SecurityGroupViewResult} 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. + */ + beginGetVMSecurityRules(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._beginGetVMSecurityRules(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetVMSecurityRules(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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. + */ + beginGetTroubleshootingWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetTroubleshooting(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; + }); + }); + } + + /** + * Initiate troubleshooting on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to + * troubleshoot. + * + * @param {string} parameters.targetResourceId The target resource to + * troubleshoot. + * + * @param {string} parameters.storageId The ID for the storage account to save + * the troubleshoot result. + * + * @param {string} parameters.storagePath The path to the blob to save the + * troubleshoot result in. + * + * @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 {TroubleshootingResult} - 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 TroubleshootingResult} 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. + */ + beginGetTroubleshooting(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._beginGetTroubleshooting(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetTroubleshooting(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Get the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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. + */ + beginGetTroubleshootingResultWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetTroubleshootingResult(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 the last completed troubleshooting result on a specified resource + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the resource to query the + * troubleshooting result. + * + * @param {string} parameters.targetResourceId The target resource ID to query + * the troubleshooting result. + * + * @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 {TroubleshootingResult} - 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 TroubleshootingResult} 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. + */ + beginGetTroubleshootingResult(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._beginGetTroubleshootingResult(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetTroubleshootingResult(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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. + */ + beginSetFlowLogConfigurationWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginSetFlowLogConfiguration(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; + }); + }); + } + + /** + * Configures flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define the configuration of flow + * log. + * + * @param {string} parameters.targetResourceId The ID of the resource to + * configure for flow logging. + * + * @param {string} parameters.storageId ID of the storage account which is used + * to store the flow log. + * + * @param {boolean} parameters.enabled Flag to enable/disable flow logging. + * + * @param {object} [parameters.retentionPolicy] + * + * @param {number} [parameters.retentionPolicy.days] Number of days to retain + * flow log records. + * + * @param {boolean} [parameters.retentionPolicy.enabled] Flag to enable/disable + * retention. + * + * @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 {FlowLogInformation} - 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 FlowLogInformation} 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. + */ + beginSetFlowLogConfiguration(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._beginSetFlowLogConfiguration(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginSetFlowLogConfiguration(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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. + */ + beginGetFlowLogStatusWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetFlowLogStatus(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; + }); + }); + } + + /** + * Queries status of flow log on a specified resource. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that define a resource to query flow + * log status. + * + * @param {string} parameters.targetResourceId The target resource where + * getting the flow logging status. + * + * @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 {FlowLogInformation} - 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 FlowLogInformation} 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. + */ + beginGetFlowLogStatus(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._beginGetFlowLogStatus(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetFlowLogStatus(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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. + */ + beginCheckConnectivityWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCheckConnectivity(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; + }); + }); + } + + /** + * Verifies the possibility of establishing a direct TCP connection from a + * virtual machine to a given endpoint including another VM or an arbitrary + * remote server. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine how the connectivity + * check will be performed. + * + * @param {object} parameters.source + * + * @param {string} parameters.source.resourceId The ID of the resource from + * which a connectivity check will be initiated. + * + * @param {number} [parameters.source.port] The source port from which a + * connectivity check will be performed. + * + * @param {object} parameters.destination + * + * @param {string} [parameters.destination.resourceId] The ID of the resource + * to which a connection attempt will be made. + * + * @param {string} [parameters.destination.address] The IP address or URI the + * resource to which a connection attempt will be made. + * + * @param {number} [parameters.destination.port] Port on which check + * connectivity will be performed. + * + * @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 {ConnectivityInformation} - 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 ConnectivityInformation} 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. + */ + beginCheckConnectivity(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._beginCheckConnectivity(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCheckConnectivity(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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. + */ + beginGetAzureReachabilityReportWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetAzureReachabilityReport(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; + }); + }); + } + + /** + * Gets the relative latency score for internet service providers from a + * specified location to Azure regions. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that determine Azure reachability + * report configuration. + * + * @param {object} parameters.providerLocation + * + * @param {string} parameters.providerLocation.country The name of the country. + * + * @param {string} [parameters.providerLocation.state] The name of the state. + * + * @param {string} [parameters.providerLocation.city] The name of the city or + * town. + * + * @param {array} [parameters.providers] List of Internet service providers. + * + * @param {array} [parameters.azureLocations] Optional Azure regions to scope + * the query to. + * + * @param {date} parameters.startTime The start time for the Azure reachability + * report. + * + * @param {date} parameters.endTime The end time for the Azure reachability + * report. + * + * @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 {AzureReachabilityReport} - 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 AzureReachabilityReport} 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. + */ + beginGetAzureReachabilityReport(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._beginGetAzureReachabilityReport(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetAzureReachabilityReport(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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. + */ + beginListAvailableProvidersWithHttpOperationResponse(resourceGroupName, networkWatcherName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginListAvailableProviders(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; + }); + }); + } + + /** + * Lists all available internet service providers for a specified Azure region. + * + * @param {string} resourceGroupName The name of the network watcher resource + * group. + * + * @param {string} networkWatcherName The name of the network watcher resource. + * + * @param {object} parameters Parameters that scope the list of available + * providers. + * + * @param {array} [parameters.azureLocations] A list of Azure regions. + * + * @param {string} [parameters.country] The country for available providers + * list. + * + * @param {string} [parameters.state] The state for available providers list. + * + * @param {string} [parameters.city] The city or town for available providers + * list. + * + * @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 {AvailableProvidersList} - 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 AvailableProvidersList} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginListAvailableProviders(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._beginListAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginListAvailableProviders(resourceGroupName, networkWatcherName, parameters, options, optionalCallback); + } + } + +} + +module.exports = NetworkWatchers; diff --git a/lib/services/networkManagement2/lib/lib/operations/operations.js b/lib/services/networkManagement2/lib/lib/operations/operations.js new file mode 100644 index 0000000000..fb99365869 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/operations.js @@ -0,0 +1,449 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * Lists all of the available Network Rest API operations. + * + * @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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion 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('/') ? '' : '/') + 'providers/Microsoft.Network/operations'; + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists all of the available Network Rest API operations. + * + * @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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['OperationListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Operations. */ +class Operations { + /** + * Create a Operations. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * Lists all of the available Network Rest API operations. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Network Rest API operations. + * + * @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 {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Lists all of the available Network Rest API operations. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all of the available Network Rest API operations. + * + * @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 {OperationListResult} - 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 OperationListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Operations; diff --git a/lib/services/networkManagement2/lib/lib/operations/packetCaptures.js b/lib/services/networkManagement2/lib/lib/operations/packetCaptures.js new file mode 100644 index 0000000000..0e78bd995f --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/packetCaptures.js @@ -0,0 +1,2323 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 PacketCaptureResult} 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 _create(resourceGroupName, networkWatcherName, packetCaptureName, 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.beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, 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['PacketCaptureResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a packet capture session by name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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 PacketCaptureResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkWatcherName, packetCaptureName, 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 (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 (packetCaptureName === null || packetCaptureName === undefined || typeof packetCaptureName.valueOf() !== 'string') { + throw new Error('packetCaptureName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{packetCaptureName}', encodeURIComponent(packetCaptureName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PacketCaptureResult']().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 packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _stop(resourceGroupName, networkWatcherName, packetCaptureName, 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.beginStop(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 PacketCaptureQueryStatusResult} 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 _getStatus(resourceGroupName, networkWatcherName, packetCaptureName, 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.beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, 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['PacketCaptureQueryStatusResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Lists all packet capture sessions within the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PacketCaptureListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkWatcherName, 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 (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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures'; + 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(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PacketCaptureListResult']().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); + }); +} + +/** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 PacketCaptureResult} 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 _beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, 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.'); + } + // 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 (packetCaptureName === null || packetCaptureName === undefined || typeof packetCaptureName.valueOf() !== 'string') { + throw new Error('packetCaptureName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{packetCaptureName}', encodeURIComponent(packetCaptureName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PacketCapture']().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 !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PacketCaptureResult']().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 packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, 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 (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 (packetCaptureName === null || packetCaptureName === undefined || typeof packetCaptureName.valueOf() !== 'string') { + throw new Error('packetCaptureName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{packetCaptureName}', encodeURIComponent(packetCaptureName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginStop(resourceGroupName, networkWatcherName, packetCaptureName, 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 (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 (packetCaptureName === null || packetCaptureName === undefined || typeof packetCaptureName.valueOf() !== 'string') { + throw new Error('packetCaptureName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{packetCaptureName}', encodeURIComponent(packetCaptureName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 PacketCaptureQueryStatusResult} 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 _beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, 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 (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 (packetCaptureName === null || packetCaptureName === undefined || typeof packetCaptureName.valueOf() !== 'string') { + throw new Error('packetCaptureName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkWatcherName}', encodeURIComponent(networkWatcherName)); + requestUrl = requestUrl.replace('{packetCaptureName}', encodeURIComponent(packetCaptureName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['PacketCaptureQueryStatusResult']().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['PacketCaptureQueryStatusResult']().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 PacketCaptures. */ +class PacketCaptures { + /** + * Create a PacketCaptures. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._create = _create; + this._get = _get; + this._deleteMethod = _deleteMethod; + this._stop = _stop; + this._getStatus = _getStatus; + this._list = _list; + this._beginCreate = _beginCreate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginStop = _beginStop; + this._beginGetStatus = _beginGetStatus; + } + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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. + */ + createWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._create(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 {PacketCaptureResult} - 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 PacketCaptureResult} 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. + */ + create(resourceGroupName, networkWatcherName, packetCaptureName, 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._create(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._create(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, optionalCallback); + } + } + + /** + * Gets a packet capture session by name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a packet capture session by name. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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 {PacketCaptureResult} - 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 PacketCaptureResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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. + */ + stopWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._stop(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + stop(resourceGroupName, networkWatcherName, packetCaptureName, 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._stop(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._stop(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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. + */ + getStatusWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 {PacketCaptureQueryStatusResult} - 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 PacketCaptureQueryStatusResult} 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. + */ + getStatus(resourceGroupName, networkWatcherName, packetCaptureName, 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._getStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Lists all packet capture sessions within the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkWatcherName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists all packet capture sessions within the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PacketCaptureListResult} - 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 PacketCaptureListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkWatcherName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkWatcherName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkWatcherName, options, optionalCallback); + } + } + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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. + */ + beginCreateWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create and start a packet capture on the specified VM. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} parameters Parameters that define the create packet capture + * operation. + * + * @param {string} parameters.target The ID of the targeted resource, only VM + * is currently supported. + * + * @param {number} [parameters.bytesToCapturePerPacket] Number of bytes + * captured per packet, the remaining bytes are truncated. + * + * @param {number} [parameters.totalBytesPerSession] Maximum size of the + * capture output. + * + * @param {number} [parameters.timeLimitInSeconds] Maximum duration of the + * capture session in seconds. + * + * @param {object} parameters.storageLocation + * + * @param {string} [parameters.storageLocation.storageId] The ID of the storage + * account to save the packet capture session. Required if no local file path + * is provided. + * + * @param {string} [parameters.storageLocation.storagePath] The URI of the + * storage path to save the packet capture. Must be a well-formed URI + * describing the location to save the packet capture. + * + * @param {string} [parameters.storageLocation.filePath] A valid local path on + * the targeting VM. Must include the name of the capture file (*.cap). For + * linux virtual machine it must start with /var/captures. Required if no + * storage ID is provided, otherwise optional. + * + * @param {array} [parameters.filters] + * + * @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 {PacketCaptureResult} - 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 PacketCaptureResult} 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. + */ + beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, 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._beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreate(resourceGroupName, networkWatcherName, packetCaptureName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @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. + */ + beginStopWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginStop(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Stops a specified packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the network watcher. + * + * @param {string} packetCaptureName The name of the packet capture session. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginStop(resourceGroupName, networkWatcherName, packetCaptureName, 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._beginStop(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginStop(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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. + */ + beginGetStatusWithHttpOperationResponse(resourceGroupName, networkWatcherName, packetCaptureName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Query the status of a running packet capture session. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkWatcherName The name of the Network Watcher resource. + * + * @param {string} packetCaptureName The name given to the packet capture + * session. + * + * @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 {PacketCaptureQueryStatusResult} - 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 PacketCaptureQueryStatusResult} 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. + */ + beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, 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._beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetStatus(resourceGroupName, networkWatcherName, packetCaptureName, options, optionalCallback); + } + } + +} + +module.exports = PacketCaptures; diff --git a/lib/services/networkManagement2/lib/lib/operations/publicIPAddresses.js b/lib/services/networkManagement2/lib/lib/operations/publicIPAddresses.js new file mode 100644 index 0000000000..d571cbb250 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/publicIPAddresses.js @@ -0,0 +1,3981 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, publicIpAddressName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, publicIpAddressName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified public IP address in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, publicIpAddressName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (publicIpAddressName === null || publicIpAddressName === undefined || typeof publicIpAddressName.valueOf() !== 'string') { + throw new Error('publicIpAddressName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/publicIPAddresses/{publicIpAddressName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{publicIpAddressName}', encodeURIComponent(publicIpAddressName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, publicIpAddressName, 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['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, publicIpAddressName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, publicIpAddressName, 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['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all the public IP addresses in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all public IP addresses in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 PublicIPAddressListResult} 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 _listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, 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-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The network interface name. + * + * @param {string} ipConfigurationName The IP configuration name. + * + * @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 PublicIPAddressListResult} 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 _listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, 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-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (ipConfigurationName === null || ipConfigurationName === undefined || typeof ipConfigurationName.valueOf() !== 'string') { + throw new Error('ipConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{ipConfigurationName}', encodeURIComponent(ipConfigurationName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().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); + }); +} + +/** + * Get the specified public IP address in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the IP configuration. + * + * @param {string} publicIpAddressName The name of the public IP Address. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 PublicIPAddress} 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 _getVirtualMachineScaleSetPublicIPAddress(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + let apiVersion = '2018-02-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 (virtualMachineScaleSetName === null || virtualMachineScaleSetName === undefined || typeof virtualMachineScaleSetName.valueOf() !== 'string') { + throw new Error('virtualMachineScaleSetName cannot be null or undefined and it must be of type string.'); + } + if (virtualmachineIndex === null || virtualmachineIndex === undefined || typeof virtualmachineIndex.valueOf() !== 'string') { + throw new Error('virtualmachineIndex cannot be null or undefined and it must be of type string.'); + } + if (networkInterfaceName === null || networkInterfaceName === undefined || typeof networkInterfaceName.valueOf() !== 'string') { + throw new Error('networkInterfaceName cannot be null or undefined and it must be of type string.'); + } + if (ipConfigurationName === null || ipConfigurationName === undefined || typeof ipConfigurationName.valueOf() !== 'string') { + throw new Error('ipConfigurationName cannot be null or undefined and it must be of type string.'); + } + if (publicIpAddressName === null || publicIpAddressName === undefined || typeof publicIpAddressName.valueOf() !== 'string') { + throw new Error('publicIpAddressName cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualMachineScaleSetName}', encodeURIComponent(virtualMachineScaleSetName)); + requestUrl = requestUrl.replace('{virtualmachineIndex}', encodeURIComponent(virtualmachineIndex)); + requestUrl = requestUrl.replace('{networkInterfaceName}', encodeURIComponent(networkInterfaceName)); + requestUrl = requestUrl.replace('{ipConfigurationName}', encodeURIComponent(ipConfigurationName)); + requestUrl = requestUrl.replace('{publicIpAddressName}', encodeURIComponent(publicIpAddressName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddress']().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 public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, publicIpAddressName, 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 (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 (publicIpAddressName === null || publicIpAddressName === undefined || typeof publicIpAddressName.valueOf() !== 'string') { + throw new Error('publicIpAddressName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{publicIpAddressName}', encodeURIComponent(publicIpAddressName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, publicIpAddressName, 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.'); + } + // 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 (publicIpAddressName === null || publicIpAddressName === undefined || typeof publicIpAddressName.valueOf() !== 'string') { + throw new Error('publicIpAddressName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{publicIpAddressName}', encodeURIComponent(publicIpAddressName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['PublicIPAddress']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, publicIpAddressName, 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.'); + } + // 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 (publicIpAddressName === null || publicIpAddressName === undefined || typeof publicIpAddressName.valueOf() !== 'string') { + throw new Error('publicIpAddressName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{publicIpAddressName}', encodeURIComponent(publicIpAddressName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddress']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the public IP addresses in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all public IP addresses in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link PublicIPAddressListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @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 PublicIPAddressListResult} 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 _listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @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 PublicIPAddressListResult} 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 _listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['PublicIPAddressListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a PublicIPAddresses. */ +class PublicIPAddresses { + /** + * Create a PublicIPAddresses. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listAll = _listAll; + this._list = _list; + this._listVirtualMachineScaleSetPublicIPAddresses = _listVirtualMachineScaleSetPublicIPAddresses; + this._listVirtualMachineScaleSetVMPublicIPAddresses = _listVirtualMachineScaleSetVMPublicIPAddresses; + this._getVirtualMachineScaleSetPublicIPAddress = _getVirtualMachineScaleSetPublicIPAddress; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + this._listVirtualMachineScaleSetPublicIPAddressesNext = _listVirtualMachineScaleSetPublicIPAddressesNext; + this._listVirtualMachineScaleSetVMPublicIPAddressesNext = _listVirtualMachineScaleSetVMPublicIPAddressesNext; + } + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, publicIpAddressName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, publicIpAddressName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, publicIpAddressName, options, optionalCallback); + } + } + + /** + * Gets the specified public IP address in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, publicIpAddressName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified public IP address in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {PublicIPAddress} - 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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, publicIpAddressName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, publicIpAddressName, options, optionalCallback); + } + } + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @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, publicIpAddressName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, publicIpAddressName, 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 static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @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 {PublicIPAddress} - 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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback); + } + } + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, publicIpAddressName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddress} - 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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddressListResult} - 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 PublicIPAddressListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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. + */ + listVirtualMachineScaleSetPublicIPAddressesWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @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 {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, 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._listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, options, optionalCallback); + } + } + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The network interface name. + * + * @param {string} ipConfigurationName The IP configuration name. + * + * @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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The network interface name. + * + * @param {string} ipConfigurationName The IP configuration name. + * + * @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 {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, 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._listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, options, optionalCallback); + } + } + + /** + * Get the specified public IP address in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the IP configuration. + * + * @param {string} publicIpAddressName The name of the public IP Address. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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. + */ + getVirtualMachineScaleSetPublicIPAddressWithHttpOperationResponse(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVirtualMachineScaleSetPublicIPAddress(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified public IP address in a virtual machine scale set. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualMachineScaleSetName The name of the virtual machine + * scale set. + * + * @param {string} virtualmachineIndex The virtual machine index. + * + * @param {string} networkInterfaceName The name of the network interface. + * + * @param {string} ipConfigurationName The name of the IP configuration. + * + * @param {string} publicIpAddressName The name of the public IP Address. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {PublicIPAddress} - 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 PublicIPAddress} 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. + */ + getVirtualMachineScaleSetPublicIPAddress(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, 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._getVirtualMachineScaleSetPublicIPAddress(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVirtualMachineScaleSetPublicIPAddress(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName, publicIpAddressName, options, optionalCallback); + } + } + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, publicIpAddressName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, publicIpAddressName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, publicIpAddressName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, publicIpAddressName, options, optionalCallback); + } + } + + /** + * Creates or updates a static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @param {string} [parameters.id] Resource ID. + * + * @param {string} [parameters.location] Resource location. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, publicIpAddressName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, publicIpAddressName, 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 static or dynamic public IP address. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to the create or update + * public IP address operation. + * + * @param {object} [parameters.sku] The public IP address SKU. + * + * @param {string} [parameters.sku.name] Name of a public IP address SKU. + * Possible values include: 'Basic', 'Standard' + * + * @param {string} [parameters.publicIPAllocationMethod] The public IP + * allocation method. Possible values are: 'Static' and 'Dynamic'. Possible + * values include: 'Static', 'Dynamic' + * + * @param {string} [parameters.publicIPAddressVersion] The public IP address + * version. Possible values are: 'IPv4' and 'IPv6'. Possible values include: + * 'IPv4', 'IPv6' + * + * @param {object} [parameters.dnsSettings] The FQDN of the DNS record + * associated with the public IP address. + * + * @param {string} [parameters.dnsSettings.domainNameLabel] Gets or sets the + * Domain name label.The concatenation of the domain name label and the + * regionalized DNS zone make up the fully qualified domain name associated + * with the public IP address. If a domain name label is specified, an A DNS + * record is created for the public IP in the Microsoft Azure DNS system. + * + * @param {string} [parameters.dnsSettings.fqdn] Gets the FQDN, Fully qualified + * domain name of the A DNS record associated with the public IP. This is the + * concatenation of the domainNameLabel and the regionalized DNS zone. + * + * @param {string} [parameters.dnsSettings.reverseFqdn] Gets or Sets the + * Reverse FQDN. A user-visible, fully qualified domain name that resolves to + * this public IP address. If the reverseFqdn is specified, then a PTR DNS + * record is created pointing from the IP address in the in-addr.arpa domain to + * the reverse FQDN. + * + * @param {array} [parameters.ipTags] The list of tags associated with the + * public IP address. + * + * @param {string} [parameters.ipAddress] The IP address associated with the + * public IP address resource. + * + * @param {number} [parameters.idleTimeoutInMinutes] The idle timeout of the + * public IP address. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * public IP resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {string} [parameters.etag] A unique read-only string that changes + * whenever the resource is updated. + * + * @param {array} [parameters.zones] A list of availability zones denoting the + * IP allocated for the resource needs to come from. + * + * @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 {PublicIPAddress} - 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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback); + } + } + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, publicIpAddressName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates public IP address tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} publicIpAddressName The name of the public IP address. + * + * @param {object} parameters Parameters supplied to update public IP address + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddress} - 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 PublicIPAddress} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, publicIpAddressName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, publicIpAddressName, parameters, options, optionalCallback); + } + } + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the public IP addresses in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all public IP addresses in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {PublicIPAddressListResult} - 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 PublicIPAddressListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @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. + */ + listVirtualMachineScaleSetPublicIPAddressesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all public IP addresses on a virtual machine scale + * set level. + * + * @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 {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetPublicIPAddressesNext(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._listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetPublicIPAddressesNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets information about all public IP addresses in a virtual machine IP + * configuration in a virtual machine scale set. + * + * @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 {PublicIPAddressListResult} - 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 PublicIPAddressListResult} 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. + */ + listVirtualMachineScaleSetVMPublicIPAddressesNext(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._listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listVirtualMachineScaleSetVMPublicIPAddressesNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = PublicIPAddresses; diff --git a/lib/services/networkManagement2/lib/lib/operations/routeFilterRules.js b/lib/services/networkManagement2/lib/lib/operations/routeFilterRules.js new file mode 100644 index 0000000000..f75f1724e6 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/routeFilterRules.js @@ -0,0 +1,2162 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, routeFilterName, ruleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, routeFilterName, ruleName, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 RouteFilterRule} 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 _update(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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.beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all RouteFilterRules in a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @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 RouteFilterRuleListResult} 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 _listByRouteFilter(resourceGroupName, routeFilterName, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRuleListResult']().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 rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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.'); + } + if (routeFilterRuleParameters === null || routeFilterRuleParameters === undefined) + { + routeFilterRuleParameters = {}; + } + // 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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (routeFilterRuleParameters === null || routeFilterRuleParameters === undefined) { + throw new Error('routeFilterRuleParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routeFilterRuleParameters !== null && routeFilterRuleParameters !== undefined) { + let requestModelMapper = new client.models['RouteFilterRule']().mapper(); + requestModel = client.serialize(requestModelMapper, routeFilterRuleParameters, 'routeFilterRuleParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routeFilterRuleParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 RouteFilterRule} 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 _beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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.'); + } + if (routeFilterRuleParameters === null || routeFilterRuleParameters === undefined) + { + routeFilterRuleParameters = {}; + } + // 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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (ruleName === null || ruleName === undefined || typeof ruleName.valueOf() !== 'string') { + throw new Error('ruleName cannot be null or undefined and it must be of type string.'); + } + if (routeFilterRuleParameters === null || routeFilterRuleParameters === undefined) { + throw new Error('routeFilterRuleParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{ruleName}', encodeURIComponent(ruleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routeFilterRuleParameters !== null && routeFilterRuleParameters !== undefined) { + let requestModelMapper = new client.models['PatchRouteFilterRule']().mapper(); + requestModel = client.serialize(requestModelMapper, routeFilterRuleParameters, 'routeFilterRuleParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routeFilterRuleParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all RouteFilterRules in a route filter. + * + * @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 RouteFilterRuleListResult} 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 _listByRouteFilterNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a RouteFilterRules. */ +class RouteFilterRules { + /** + * Create a RouteFilterRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByRouteFilter = _listByRouteFilter; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdate = _beginUpdate; + this._listByRouteFilterNext = _listByRouteFilterNext; + } + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, routeFilterName, ruleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, routeFilterName, ruleName, options, optionalCallback); + } + } + + /** + * Gets the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteFilterRule} - 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 RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, routeFilterName, ruleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, routeFilterName, ruleName, options, optionalCallback); + } + } + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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 route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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 RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback); + } + } + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + updateWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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 RouteFilterRule} 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. + */ + update(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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._update(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback); + } + } + + /** + * Gets all RouteFilterRules in a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @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. + */ + listByRouteFilterWithHttpOperationResponse(resourceGroupName, routeFilterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByRouteFilter(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all RouteFilterRules in a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @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 {RouteFilterRuleListResult} - 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 RouteFilterRuleListResult} 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. + */ + listByRouteFilter(resourceGroupName, routeFilterName, 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._listByRouteFilter(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByRouteFilter(resourceGroupName, routeFilterName, options, optionalCallback); + } + } + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified rule from a route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, routeFilterName, ruleName, options, optionalCallback); + } + } + + /** + * Creates or updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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 route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the create + * or update route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.name] The name of the resource + * that is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeFilterRuleParameters.location] Resource location. + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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 RouteFilterRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback); + } + } + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route in the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {string} ruleName The name of the route filter rule. + * + * @param {object} routeFilterRuleParameters Parameters supplied to the update + * route filter rule operation. + * + * @param {string} routeFilterRuleParameters.access The access type of the + * rule. Valid values are: 'Allow', 'Deny'. Possible values include: 'Allow', + * 'Deny' + * + * @param {array} routeFilterRuleParameters.communities The collection for bgp + * community values to filter on. e.g. ['12076:5010','12076:5020'] + * + * @param {string} [routeFilterRuleParameters.id] Resource 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 {RouteFilterRule} - 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 RouteFilterRule} 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. + */ + beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, 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._beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, options, optionalCallback); + } + } + + /** + * Gets all RouteFilterRules in a route filter. + * + * @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. + */ + listByRouteFilterNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByRouteFilterNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all RouteFilterRules in a route filter. + * + * @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 {RouteFilterRuleListResult} - 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 RouteFilterRuleListResult} 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. + */ + listByRouteFilterNext(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._listByRouteFilterNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByRouteFilterNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = RouteFilterRules; diff --git a/lib/services/networkManagement2/lib/lib/operations/routeFilters.js b/lib/services/networkManagement2/lib/lib/operations/routeFilters.js new file mode 100644 index 0000000000..3dc57d7eb0 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/routeFilters.js @@ -0,0 +1,2510 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, routeFilterName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, routeFilterName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced express route bgp + * peering resources. + * + * @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 RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, routeFilterName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/routeFilters/{routeFilterName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 RouteFilter} 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 _update(resourceGroupName, routeFilterName, routeFilterParameters, 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.beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all route filters in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroup(resourceGroupName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // 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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route filters in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterListResult']().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 route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, routeFilterName, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (routeFilterParameters === null || routeFilterParameters === undefined) { + throw new Error('routeFilterParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routeFilterParameters !== null && routeFilterParameters !== undefined) { + let requestModelMapper = new client.models['RouteFilter']().mapper(); + requestModel = client.serialize(requestModelMapper, routeFilterParameters, 'routeFilterParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routeFilterParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 RouteFilter} 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 _beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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 (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 (routeFilterName === null || routeFilterName === undefined || typeof routeFilterName.valueOf() !== 'string') { + throw new Error('routeFilterName cannot be null or undefined and it must be of type string.'); + } + if (routeFilterParameters === null || routeFilterParameters === undefined) { + throw new Error('routeFilterParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeFilterName}', encodeURIComponent(routeFilterName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routeFilterParameters !== null && routeFilterParameters !== undefined) { + let requestModelMapper = new client.models['PatchRouteFilter']().mapper(); + requestModel = client.serialize(requestModelMapper, routeFilterParameters, 'routeFilterParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routeFilterParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilter']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route filters in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listByResourceGroupNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route filters in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteFilterListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a RouteFilters. */ +class RouteFilters { + /** + * Create a RouteFilters. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._update = _update; + this._listByResourceGroup = _listByResourceGroup; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdate = _beginUpdate; + this._listByResourceGroupNext = _listByResourceGroupNext; + this._listNext = _listNext; + } + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, routeFilterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, routeFilterName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, routeFilterName, options, optionalCallback); + } + } + + /** + * Gets the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced express route bgp + * peering resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, routeFilterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced express route bgp + * peering resources. + * + * @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 {RouteFilter} - 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 RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, routeFilterName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, routeFilterName, options, optionalCallback); + } + } + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.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, routeFilterName, routeFilterParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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 route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.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 {RouteFilter} - 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 RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback); + } + } + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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. + */ + updateWithHttpOperationResponse(resourceGroupName, routeFilterName, routeFilterParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._update(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 {RouteFilter} - 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 RouteFilter} 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. + */ + update(resourceGroupName, routeFilterName, routeFilterParameters, 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._update(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._update(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback); + } + } + + /** + * Gets all route filters in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route filters in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteFilterListResult} - 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 RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroup(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroup(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroup(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all route filters in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route filters in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteFilterListResult} - 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 RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(options, optionalCallback); + } + } + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, routeFilterName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route filter. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, routeFilterName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeFilterName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, routeFilterName, options, optionalCallback); + } + } + + /** + * Creates or updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, routeFilterName, routeFilterParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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 route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the create or + * update route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {string} [routeFilterParameters.id] Resource ID. + * + * @param {string} [routeFilterParameters.location] Resource location. + * + * @param {object} [routeFilterParameters.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 {RouteFilter} - 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 RouteFilter} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback); + } + } + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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. + */ + beginUpdateWithHttpOperationResponse(resourceGroupName, routeFilterName, routeFilterParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route filter in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeFilterName The name of the route filter. + * + * @param {object} routeFilterParameters Parameters supplied to the update + * route filter operation. + * + * @param {array} [routeFilterParameters.rules] Collection of RouteFilterRules + * contained within a route filter. + * + * @param {array} [routeFilterParameters.peerings] A collection of references + * to express route circuit peerings. + * + * @param {object} [routeFilterParameters.tags] Resource tags. + * + * @param {string} [routeFilterParameters.id] Resource 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 {RouteFilter} - 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 RouteFilter} 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. + */ + beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, 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._beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdate(resourceGroupName, routeFilterName, routeFilterParameters, options, optionalCallback); + } + } + + /** + * Gets all route filters in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listByResourceGroupNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route filters in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteFilterListResult} - 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 RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listByResourceGroupNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listByResourceGroupNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listByResourceGroupNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all route filters in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route filters in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteFilterListResult} - 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 RouteFilterListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = RouteFilters; diff --git a/lib/services/networkManagement2/lib/lib/operations/routeTables.js b/lib/services/networkManagement2/lib/lib/operations/routeTables.js new file mode 100644 index 0000000000..4a5ee2f20a --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/routeTables.js @@ -0,0 +1,2495 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, routeTableName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, routeTableName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, routeTableName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/routeTables/{routeTableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTable']().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); + }); +} + + +/** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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} 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, routeTableName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, routeTableName, 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['RouteTable']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, routeTableName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, routeTableName, 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['RouteTable']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all route tables in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route tables in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTableListResult']().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 route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, routeTableName, 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 (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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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} 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, routeTableName, 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.'); + } + // 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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['RouteTable']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTable']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTable']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, routeTableName, 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.'); + } + // 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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTable']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route tables in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all route tables in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link RouteTableListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteTableListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a RouteTables. */ +class RouteTables { + /** + * Create a RouteTables. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._list = _list; + this._listAll = _listAll; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listNext = _listNext; + this._listAllNext = _listAllNext; + } + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, routeTableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeTableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, routeTableName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeTableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, routeTableName, options, optionalCallback); + } + } + + /** + * Gets the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, routeTableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeTableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {RouteTable} - 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, routeTableName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeTableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, routeTableName, options, optionalCallback); + } + } + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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, routeTableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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 {RouteTable} - 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, routeTableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, routeTableName, parameters, options, optionalCallback); + } + } + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, routeTableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTable} - 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, routeTableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, routeTableName, parameters, options, optionalCallback); + } + } + + /** + * Gets all route tables in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTableListResult} - 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 RouteTableListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all route tables in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTableListResult} - 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 RouteTableListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, routeTableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeTableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, routeTableName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeTableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, routeTableName, options, optionalCallback); + } + } + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, routeTableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Create or updates a route table in a specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to the create or update route + * table operation. + * + * @param {array} [parameters.routes] Collection of routes contained within a + * route table. + * + * @param {boolean} [parameters.disableBgpRoutePropagation] Gets or sets + * whether to disable the routes learned by BGP on that route table. True means + * disable. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [parameters.etag] Gets 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 {RouteTable} - 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, routeTableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, routeTableName, parameters, options, optionalCallback); + } + } + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, routeTableName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a route table tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} parameters Parameters supplied to update route table tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTable} - 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 RouteTable} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, routeTableName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, routeTableName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, routeTableName, parameters, options, optionalCallback); + } + } + + /** + * Gets all route tables in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTableListResult} - 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 RouteTableListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all route tables in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all route tables in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {RouteTableListResult} - 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 RouteTableListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = RouteTables; diff --git a/lib/services/networkManagement2/lib/lib/operations/routes.js b/lib/services/networkManagement2/lib/lib/operations/routes.js new file mode 100644 index 0000000000..cdb3db5d01 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/routes.js @@ -0,0 +1,1708 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, routeTableName, routeName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, routeTableName, routeName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, routeTableName, routeName, 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 (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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (routeName === null || routeName === undefined || typeof routeName.valueOf() !== 'string') { + throw new Error('routeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{routeName}', encodeURIComponent(routeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Route']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, 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['Route']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all routes in a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @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 RouteListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, routeTableName, 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 (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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteListResult']().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 route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, routeTableName, routeName, 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 (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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (routeName === null || routeName === undefined || typeof routeName.valueOf() !== 'string') { + throw new Error('routeName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{routeName}', encodeURIComponent(routeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, 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 (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 (routeTableName === null || routeTableName === undefined || typeof routeTableName.valueOf() !== 'string') { + throw new Error('routeTableName cannot be null or undefined and it must be of type string.'); + } + if (routeName === null || routeName === undefined || typeof routeName.valueOf() !== 'string') { + throw new Error('routeName cannot be null or undefined and it must be of type string.'); + } + if (routeParameters === null || routeParameters === undefined) { + throw new Error('routeParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{routeTableName}', encodeURIComponent(routeTableName)); + requestUrl = requestUrl.replace('{routeName}', encodeURIComponent(routeName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (routeParameters !== null && routeParameters !== undefined) { + let requestModelMapper = new client.models['Route']().mapper(); + requestModel = client.serialize(requestModelMapper, routeParameters, 'routeParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(routeParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Route']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Route']().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); + }); +} + +/** + * Gets all routes in a route table. + * + * @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 RouteListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['RouteListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Routes. */ +class Routes { + /** + * Create a Routes. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, routeTableName, routeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, routeTableName, routeName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, routeTableName, routeName, options, optionalCallback); + } + } + + /** + * Gets the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, routeTableName, routeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @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 {Route} - 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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, routeTableName, routeName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, routeTableName, routeName, options, optionalCallback); + } + } + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, routeTableName, routeName, routeParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, 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 route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 {Route} - 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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, optionalCallback); + } + } + + /** + * Gets all routes in a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, routeTableName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, routeTableName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all routes in a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @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 {RouteListResult} - 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 RouteListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, routeTableName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, routeTableName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, routeTableName, options, optionalCallback); + } + } + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, routeTableName, routeName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified route from a route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, routeTableName, routeName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, routeTableName, routeName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, routeTableName, routeName, options, optionalCallback); + } + } + + /** + * Creates or updates a route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, routeTableName, routeName, routeParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, 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 route in the specified route table. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} routeTableName The name of the route table. + * + * @param {string} routeName The name of the route. + * + * @param {object} routeParameters Parameters supplied to the create or update + * route operation. + * + * @param {string} [routeParameters.addressPrefix] The destination CIDR to + * which the route applies. + * + * @param {string} routeParameters.nextHopType The type of Azure hop the packet + * should be sent to. Possible values are: 'VirtualNetworkGateway', + * 'VnetLocal', 'Internet', 'VirtualAppliance', and 'None'. Possible values + * include: 'VirtualNetworkGateway', 'VnetLocal', 'Internet', + * 'VirtualAppliance', 'None' + * + * @param {string} [routeParameters.nextHopIpAddress] The IP address packets + * should be forwarded to. Next hop values are only allowed in routes where the + * next hop type is VirtualAppliance. + * + * @param {string} [routeParameters.provisioningState] The provisioning state + * of the resource. Possible values are: 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [routeParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [routeParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [routeParameters.id] Resource 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 {Route} - 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 Route} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, options, optionalCallback); + } + } + + /** + * Gets all routes in a route table. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all routes in a route table. + * + * @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 {RouteListResult} - 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 RouteListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Routes; diff --git a/lib/services/networkManagement2/lib/lib/operations/securityRules.js b/lib/services/networkManagement2/lib/lib/operations/securityRules.js new file mode 100644 index 0000000000..a1ed0bc9bc --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/securityRules.js @@ -0,0 +1,2006 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Get the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, networkSecurityGroupName, securityRuleName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (securityRuleName === null || securityRuleName === undefined || typeof securityRuleName.valueOf() !== 'string') { + throw new Error('securityRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{securityRuleName}', encodeURIComponent(securityRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, 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['SecurityRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, networkSecurityGroupName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRuleListResult']().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 security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (securityRuleName === null || securityRuleName === undefined || typeof securityRuleName.valueOf() !== 'string') { + throw new Error('securityRuleName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{securityRuleName}', encodeURIComponent(securityRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, 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 (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 (networkSecurityGroupName === null || networkSecurityGroupName === undefined || typeof networkSecurityGroupName.valueOf() !== 'string') { + throw new Error('networkSecurityGroupName cannot be null or undefined and it must be of type string.'); + } + if (securityRuleName === null || securityRuleName === undefined || typeof securityRuleName.valueOf() !== 'string') { + throw new Error('securityRuleName cannot be null or undefined and it must be of type string.'); + } + if (securityRuleParameters === null || securityRuleParameters === undefined) { + throw new Error('securityRuleParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{networkSecurityGroupName}', encodeURIComponent(networkSecurityGroupName)); + requestUrl = requestUrl.replace('{securityRuleName}', encodeURIComponent(securityRuleName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (securityRuleParameters !== null && securityRuleParameters !== undefined) { + let requestModelMapper = new client.models['SecurityRule']().mapper(); + requestModel = client.serialize(requestModelMapper, securityRuleParameters, 'securityRuleParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(securityRuleParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRule']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRule']().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); + }); +} + +/** + * Gets all security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SecurityRuleListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a SecurityRules. */ +class SecurityRules { + /** + * Create a SecurityRules. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback); + } + } + + /** + * Get the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Get the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRule} - 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback); + } + } + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, 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 security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 {SecurityRule} - 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, optionalCallback); + } + } + + /** + * Gets all security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all security rules in a network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRuleListResult} - 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 SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, networkSecurityGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, networkSecurityGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, networkSecurityGroupName, options, optionalCallback); + } + } + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified network security rule. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, networkSecurityGroupName, securityRuleName, options, optionalCallback); + } + } + + /** + * Creates or updates a security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, 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 security rule in the specified network security group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} networkSecurityGroupName The name of the network security + * group. + * + * @param {string} securityRuleName The name of the security rule. + * + * @param {object} securityRuleParameters Parameters supplied to the create or + * update network security rule operation. + * + * @param {string} [securityRuleParameters.description] A description for this + * rule. Restricted to 140 chars. + * + * @param {string} securityRuleParameters.protocol Network protocol this rule + * applies to. Possible values are 'Tcp', 'Udp', and '*'. Possible values + * include: 'Tcp', 'Udp', '*' + * + * @param {string} [securityRuleParameters.sourcePortRange] The source port or + * range. Integer or range between 0 and 65535. Asterix '*' can also be used to + * match all ports. + * + * @param {string} [securityRuleParameters.destinationPortRange] The + * destination port or range. Integer or range between 0 and 65535. Asterix '*' + * can also be used to match all ports. + * + * @param {string} [securityRuleParameters.sourceAddressPrefix] The CIDR or + * source IP range. Asterix '*' can also be used to match all source IPs. + * Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + * can also be used. If this is an ingress rule, specifies where network + * traffic originates from. + * + * @param {array} [securityRuleParameters.sourceAddressPrefixes] The CIDR or + * source IP ranges. + * + * @param {array} [securityRuleParameters.sourceApplicationSecurityGroups] The + * application security group specified as source. + * + * @param {string} [securityRuleParameters.destinationAddressPrefix] The + * destination address prefix. CIDR or destination IP range. Asterix '*' can + * also be used to match all source IPs. Default tags such as 'VirtualNetwork', + * 'AzureLoadBalancer' and 'Internet' can also be used. + * + * @param {array} [securityRuleParameters.destinationAddressPrefixes] The + * destination address prefixes. CIDR or destination IP ranges. + * + * @param {array} [securityRuleParameters.destinationApplicationSecurityGroups] + * The application security group specified as destination. + * + * @param {array} [securityRuleParameters.sourcePortRanges] The source port + * ranges. + * + * @param {array} [securityRuleParameters.destinationPortRanges] The + * destination port ranges. + * + * @param {string} securityRuleParameters.access The network traffic is allowed + * or denied. Possible values are: 'Allow' and 'Deny'. Possible values include: + * 'Allow', 'Deny' + * + * @param {number} [securityRuleParameters.priority] The priority of the rule. + * The value can be between 100 and 4096. The priority number must be unique + * for each rule in the collection. The lower the priority number, the higher + * the priority of the rule. + * + * @param {string} securityRuleParameters.direction The direction of the rule. + * The direction specifies if rule will be evaluated on incoming or outcoming + * traffic. Possible values are: 'Inbound' and 'Outbound'. Possible values + * include: 'Inbound', 'Outbound' + * + * @param {string} [securityRuleParameters.provisioningState] The provisioning + * state of the public IP resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [securityRuleParameters.name] The name of the resource that + * is unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [securityRuleParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [securityRuleParameters.id] Resource 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 {SecurityRule} - 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 SecurityRule} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, options, optionalCallback); + } + } + + /** + * Gets all security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all security rules in a network security group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {SecurityRuleListResult} - 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 SecurityRuleListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = SecurityRules; diff --git a/lib/services/networkManagement2/lib/lib/operations/subnets.js b/lib/services/networkManagement2/lib/lib/operations/subnets.js new file mode 100644 index 0000000000..d0ba19ebaa --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/subnets.js @@ -0,0 +1,1991 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified subnet by virtual network and resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, virtualNetworkName, subnetName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (subnetName === null || subnetName === undefined || typeof subnetName.valueOf() !== 'string') { + throw new Error('subnetName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subnetName}', encodeURIComponent(subnetName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Subnet']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, 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['Subnet']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all subnets in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 SubnetListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, virtualNetworkName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SubnetListResult']().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 subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (subnetName === null || subnetName === undefined || typeof subnetName.valueOf() !== 'string') { + throw new Error('subnetName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subnetName}', encodeURIComponent(subnetName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (subnetName === null || subnetName === undefined || typeof subnetName.valueOf() !== 'string') { + throw new Error('subnetName cannot be null or undefined and it must be of type string.'); + } + if (subnetParameters === null || subnetParameters === undefined) { + throw new Error('subnetParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subnetName}', encodeURIComponent(subnetName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (subnetParameters !== null && subnetParameters !== undefined) { + let requestModelMapper = new client.models['Subnet']().mapper(); + requestModel = client.serialize(requestModelMapper, subnetParameters, 'subnetParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(subnetParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Subnet']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['Subnet']().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); + }); +} + +/** + * Gets all subnets in a virtual network. + * + * @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 SubnetListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['SubnetListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Subnets. */ +class Subnets { + /** + * Create a Subnets. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, subnetName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback); + } + } + + /** + * Gets the specified subnet by virtual network and resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, virtualNetworkName, subnetName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified subnet by virtual network and resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {Subnet} - 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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback); + } + } + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, 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 subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 {Subnet} - 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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, optionalCallback); + } + } + + /** + * Gets all subnets in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all subnets in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {SubnetListResult} - 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 SubnetListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, virtualNetworkName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, subnetName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified subnet. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualNetworkName, subnetName, options, optionalCallback); + } + } + + /** + * Creates or updates a subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, 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 subnet in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} subnetName The name of the subnet. + * + * @param {object} subnetParameters Parameters supplied to the create or update + * subnet operation. + * + * @param {string} [subnetParameters.addressPrefix] The address prefix for the + * subnet. + * + * @param {object} [subnetParameters.networkSecurityGroup] The reference of the + * NetworkSecurityGroup resource. + * + * @param {array} [subnetParameters.networkSecurityGroup.securityRules] A + * collection of security rules of the network security group. + * + * @param {array} [subnetParameters.networkSecurityGroup.defaultSecurityRules] + * The default security rules of network security group. + * + * @param {string} [subnetParameters.networkSecurityGroup.resourceGuid] The + * resource GUID property of the network security group resource. + * + * @param {string} [subnetParameters.networkSecurityGroup.provisioningState] + * The provisioning state of the public IP resource. Possible values are: + * 'Updating', 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.networkSecurityGroup.etag] A unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.networkSecurityGroup.id] Resource ID. + * + * @param {string} [subnetParameters.networkSecurityGroup.location] Resource + * location. + * + * @param {object} [subnetParameters.networkSecurityGroup.tags] Resource tags. + * + * @param {object} [subnetParameters.routeTable] The reference of the + * RouteTable resource. + * + * @param {array} [subnetParameters.routeTable.routes] Collection of routes + * contained within a route table. + * + * @param {boolean} [subnetParameters.routeTable.disableBgpRoutePropagation] + * Gets or sets whether to disable the routes learned by BGP on that route + * table. True means disable. + * + * @param {string} [subnetParameters.routeTable.provisioningState] The + * provisioning state of the resource. Possible values are: 'Updating', + * 'Deleting', and 'Failed'. + * + * @param {string} [subnetParameters.routeTable.etag] Gets a unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [subnetParameters.routeTable.id] Resource ID. + * + * @param {string} [subnetParameters.routeTable.location] Resource location. + * + * @param {object} [subnetParameters.routeTable.tags] Resource tags. + * + * @param {array} [subnetParameters.serviceEndpoints] An array of service + * endpoints. + * + * @param {array} [subnetParameters.resourceNavigationLinks] Gets an array of + * references to the external resources using subnet. + * + * @param {string} [subnetParameters.provisioningState] The provisioning state + * of the resource. + * + * @param {string} [subnetParameters.name] The name of the resource that is + * unique within a resource group. This name can be used to access the + * resource. + * + * @param {string} [subnetParameters.etag] A unique read-only string that + * changes whenever the resource is updated. + * + * @param {string} [subnetParameters.id] Resource 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 {Subnet} - 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 Subnet} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, options, optionalCallback); + } + } + + /** + * Gets all subnets in a virtual network. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all subnets in a virtual network. + * + * @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 {SubnetListResult} - 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 SubnetListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Subnets; diff --git a/lib/services/networkManagement2/lib/lib/operations/usages.js b/lib/services/networkManagement2/lib/lib/operations/usages.js new file mode 100644 index 0000000000..e3a083f0ba --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/usages.js @@ -0,0 +1,469 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + +/** + * List network usages for a subscription. + * + * @param {string} location The location where resource usage is queried. + * + * @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 UsagesListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(location, 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 (location === null || location === undefined || typeof location.valueOf() !== 'string') { + throw new Error('location cannot be null or undefined and it must be of type string.'); + } + if (location !== null && location !== undefined) { + if (location.match(/^[-\w\._]+$/) === null) + { + throw new Error('"location" should satisfy the constraint - "Pattern": /^[-\w\._]+$/'); + } + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages'; + requestUrl = requestUrl.replace('{location}', encodeURIComponent(location)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsagesListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * List network usages for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link UsagesListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['UsagesListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a Usages. */ +class Usages { + /** + * Create a Usages. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._list = _list; + this._listNext = _listNext; + } + + /** + * List network usages for a subscription. + * + * @param {string} location The location where resource usage is queried. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(location, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List network usages for a subscription. + * + * @param {string} location The location where resource usage is queried. + * + * @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 {UsagesListResult} - 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 UsagesListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(location, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(location, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(location, options, optionalCallback); + } + } + + /** + * List network usages for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * List network usages for a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {UsagesListResult} - 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 UsagesListResult} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = Usages; diff --git a/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGatewayConnections.js b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGatewayConnections.js new file mode 100644 index 0000000000..e40db35d68 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGatewayConnections.js @@ -0,0 +1,4221 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, 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['VirtualNetworkGatewayConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified virtual network gateway connection by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, virtualNetworkGatewayConnectionName, 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 (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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnection']().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 virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, 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['VirtualNetworkGatewayConnectionListEntity']().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); + }); + }); +} + + +/** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 ConnectionSharedKey} 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 _setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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.beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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['ConnectionSharedKey']().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); + }); + }); +} + +/** + * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves + * information about the specified virtual network gateway connection shared + * key through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection shared key name. + * + * @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 ConnectionSharedKey} 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 _getSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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 (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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionSharedKey']().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); + }); +} + +/** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnectionListResult']().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); + }); +} + + +/** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 ConnectionResetSharedKey} 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 _resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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.beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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['ConnectionResetSharedKey']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, 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.'); + } + // 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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['VirtualNetworkGatewayConnection']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnection']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, 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 (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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, 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.'); + } + // 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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnectionListEntity']().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); + }); +} + +/** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 ConnectionSharedKey} 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 _beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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.'); + } + // 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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['ConnectionSharedKey']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionSharedKey']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['ConnectionSharedKey']().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); + }); +} + +/** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 ConnectionResetSharedKey} 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 _beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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.'); + } + // 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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['ConnectionResetSharedKey']().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['ConnectionResetSharedKey']().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); + }); +} + +/** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @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 VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayConnectionListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a VirtualNetworkGatewayConnections. */ +class VirtualNetworkGatewayConnections { + /** + * Create a VirtualNetworkGatewayConnections. + * @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._setSharedKey = _setSharedKey; + this._getSharedKey = _getSharedKey; + this._list = _list; + this._resetSharedKey = _resetSharedKey; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdateTags = _beginUpdateTags; + this._beginSetSharedKey = _beginSetSharedKey; + this._beginResetSharedKey = _beginResetSharedKey; + this._listNext = _listNext; + } + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, 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 virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetworkGatewayConnection} - 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 VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Gets the specified virtual network gateway connection by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified virtual network gateway connection by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayConnection} - 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 VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback); + } + } + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayConnectionListEntity} - 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 VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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. + */ + setSharedKeyWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 {ConnectionSharedKey} - 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 ConnectionSharedKey} 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. + */ + setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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._setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves + * information about the specified virtual network gateway connection shared + * key through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection shared key name. + * + * @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. + */ + getSharedKeyWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Get VirtualNetworkGatewayConnectionSharedKey operation retrieves + * information about the specified virtual network gateway connection shared + * key through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection shared key name. + * + * @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 {ConnectionSharedKey} - 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 ConnectionSharedKey} 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. + */ + getSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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._getSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback); + } + } + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayConnectionListResult} - 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 VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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. + */ + resetSharedKeyWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 {ConnectionResetSharedKey} - 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 ConnectionResetSharedKey} 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. + */ + resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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._resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._resetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Creates or updates a virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, 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 virtual network gateway connection in the specified + * resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network gateway connection operation. + * + * @param {string} [parameters.authorizationKey] The authorizationKey. + * + * @param {object} parameters.virtualNetworkGateway1 The reference to virtual + * network gateway resource. + * + * @param {object} [parameters.virtualNetworkGateway2] The reference to virtual + * network gateway resource. + * + * @param {array} [parameters.virtualNetworkGateway2.ipConfigurations] IP + * configurations for virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.gatewayType] The type of + * this virtual network gateway. Possible values are: 'Vpn' and 'ExpressRoute'. + * Possible values include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.virtualNetworkGateway2.vpnType] The type of this + * virtual network gateway. Possible values are: 'PolicyBased' and + * 'RouteBased'. Possible values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.virtualNetworkGateway2.enableBgp] Whether BGP + * is enabled for this virtual network gateway or not. + * + * @param {boolean} [parameters.virtualNetworkGateway2.activeActive] + * ActiveActive flag + * + * @param {object} [parameters.virtualNetworkGateway2.gatewayDefaultSite] The + * reference of the LocalNetworkGateway resource which represents local network + * site having default routes. Assign Null value in case of removing existing + * default site setting. + * + * @param {object} [parameters.virtualNetworkGateway2.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.virtualNetworkGateway2.sku.name] Gateway SKU + * name. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.virtualNetworkGateway2.sku.tier] Gateway SKU + * tier. Possible values include: 'Basic', 'HighPerformance', 'Standard', + * 'UltraPerformance', 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.virtualNetworkGateway2.sku.capacity] The + * capacity. + * + * @param {object} [parameters.virtualNetworkGateway2.vpnClientConfiguration] + * The reference of the VpnClientConfiguration resource which represents the + * P2S VpnClient configurations. + * + * @param {object} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientAddressPool] + * The reference of the address space resource which represents Address space + * for P2S VpnClient. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerAddress] + * The radius server address property of the VirtualNetworkGateway resource for + * vpn client connection. + * + * @param {string} + * [parameters.virtualNetworkGateway2.vpnClientConfiguration.radiusServerSecret] + * The radius secret property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {object} [parameters.virtualNetworkGateway2.bgpSettings] Virtual + * network gateway's BGP speaker settings. + * + * @param {string} [parameters.virtualNetworkGateway2.resourceGuid] The + * resource GUID property of the VirtualNetworkGateway resource. + * + * @param {string} [parameters.virtualNetworkGateway2.etag] Gets a unique + * read-only string that changes whenever the resource is updated. + * + * @param {string} [parameters.virtualNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.virtualNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.virtualNetworkGateway2.tags] Resource tags. + * + * @param {object} [parameters.localNetworkGateway2] The reference to local + * network gateway resource. + * + * @param {object} [parameters.localNetworkGateway2.localNetworkAddressSpace] + * Local network site address space. + * + * @param {array} + * [parameters.localNetworkGateway2.localNetworkAddressSpace.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [parameters.localNetworkGateway2.gatewayIpAddress] IP + * address of local network gateway. + * + * @param {object} [parameters.localNetworkGateway2.bgpSettings] Local network + * gateway's BGP speaker settings. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.asn] The BGP + * speaker's ASN. + * + * @param {string} + * [parameters.localNetworkGateway2.bgpSettings.bgpPeeringAddress] The BGP + * peering address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.localNetworkGateway2.bgpSettings.peerWeight] The + * weight added to routes learned from this BGP speaker. + * + * @param {string} [parameters.localNetworkGateway2.resourceGuid] The resource + * GUID property of the LocalNetworkGateway resource. + * + * @param {string} [parameters.localNetworkGateway2.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [parameters.localNetworkGateway2.id] Resource ID. + * + * @param {string} [parameters.localNetworkGateway2.location] Resource + * location. + * + * @param {object} [parameters.localNetworkGateway2.tags] Resource tags. + * + * @param {string} parameters.connectionType Gateway connection type. Possible + * values are: 'Ipsec','Vnet2Vnet','ExpressRoute', and 'VPNClient. Possible + * values include: 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' + * + * @param {number} [parameters.routingWeight] The routing weight. + * + * @param {string} [parameters.sharedKey] The IPSec shared key. + * + * @param {object} [parameters.peer] The reference to peerings resource. + * + * @param {string} [parameters.peer.id] Resource ID. + * + * @param {boolean} [parameters.enableBgp] EnableBgp flag + * + * @param {boolean} [parameters.usePolicyBasedTrafficSelectors] Enable + * policy-based traffic selectors. + * + * @param {array} [parameters.ipsecPolicies] The IPSec Policies to be + * considered by this connection. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGatewayConnection resource. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetworkGatewayConnection} - 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 VirtualNetworkGatewayConnection} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network Gateway connection. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayConnectionName, options, optionalCallback); + } + } + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network gateway connection tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway connection tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayConnectionListEntity} - 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 VirtualNetworkGatewayConnectionListEntity} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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. + */ + beginSetSharedKeyWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual + * network gateway connection shared key for passed virtual network gateway + * connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection name. + * + * @param {object} parameters Parameters supplied to the Begin Set Virtual + * Network Gateway connection Shared key operation throughNetwork resource + * provider. + * + * @param {string} parameters.value The virtual network connection shared key + * value. + * + * @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 {ConnectionSharedKey} - 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 ConnectionSharedKey} 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. + */ + beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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._beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginSetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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. + */ + beginResetSharedKeyWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The VirtualNetworkGatewayConnectionResetSharedKey operation resets the + * virtual network gateway connection shared key for passed virtual network + * gateway connection in the specified resource group through Network resource + * provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The virtual network + * gateway connection reset shared key Name. + * + * @param {object} parameters Parameters supplied to the begin reset virtual + * network gateway connection shared key operation through network resource + * provider. + * + * @param {number} parameters.keyLength The virtual network connection reset + * shared key length, should between 1 and 128. + * + * @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 {ConnectionResetSharedKey} - 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 ConnectionResetSharedKey} 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. + */ + beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, 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._beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginResetSharedKey(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The List VirtualNetworkGatewayConnections operation retrieves all the + * virtual network gateways connections created. + * + * @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 {VirtualNetworkGatewayConnectionListResult} - 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 VirtualNetworkGatewayConnectionListResult} + * for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualNetworkGatewayConnections; diff --git a/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGateways.js b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGateways.js new file mode 100644 index 0000000000..c649890237 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkGateways.js @@ -0,0 +1,7822 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, 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['VirtualNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified virtual network gateway by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGateway']().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 virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, virtualNetworkGatewayName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, 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['VirtualNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all virtual network gateways by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the connections in a virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 VirtualNetworkGatewayListConnectionsResult} + * 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 _listConnections(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/connections'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayListConnectionsResult']().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); + }); +} + + +/** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 VirtualNetworkGateway} 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 _reset(resourceGroupName, virtualNetworkGatewayName, 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.beginReset(resourceGroupName, virtualNetworkGatewayName, 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['VirtualNetworkGateway']().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); + }); + }); +} + + +/** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, 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.beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); + }); +} + + +/** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _generateVpnProfile(resourceGroupName, virtualNetworkGatewayName, 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.beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _getVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, 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.beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); + }); +} + + +/** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 BgpPeerStatusListResult} 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 _getBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, 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.beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, 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['BgpPeerStatusListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a xml format representation for supported vpn devices. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/supportedvpndevices'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + + +/** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 GatewayRouteListResult} 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 _getLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, 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.beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, 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['GatewayRouteListResult']().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); + }); + }); +} + + +/** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 GatewayRouteListResult} 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 _getAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, 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.beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, 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['GatewayRouteListResult']().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); + }); + }); +} + + +/** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 VpnClientIPsecParameters} 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 _setVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, 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.beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, 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['VpnClientIPsecParameters']().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); + }); + }); +} + + +/** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 VpnClientIPsecParameters} 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 _getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, 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.beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, 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['VpnClientIPsecParameters']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets a xml format representation for vpn device configuration script. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection for which the configuration script is generated. + * + * @param {object} parameters Parameters supplied to the generate vpn device + * script operation. + * + * @param {string} [parameters.vendor] The vendor for the vpn device. + * + * @param {string} [parameters.deviceFamily] The device family for the vpn + * device. + * + * @param {string} [parameters.firmwareVersion] The firmware version for the + * vpn device. + * + * @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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _vpnDeviceConfigurationScript(resourceGroupName, virtualNetworkGatewayConnectionName, 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.'); + } + // 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 (virtualNetworkGatewayConnectionName === null || virtualNetworkGatewayConnectionName === undefined || typeof virtualNetworkGatewayConnectionName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayConnectionName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/vpndeviceconfigurationscript'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayConnectionName}', encodeURIComponent(virtualNetworkGatewayConnectionName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['VpnDeviceScriptParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, 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.'); + } + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['VirtualNetworkGateway']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGateway']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, 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.'); + } + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGateway']().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); + }); +} + +/** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 VirtualNetworkGateway} 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 _beginReset(resourceGroupName, virtualNetworkGatewayName, 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 gatewayVip = (options && options.gatewayVip !== undefined) ? options.gatewayVip : undefined; + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (gatewayVip !== null && gatewayVip !== undefined && typeof gatewayVip.valueOf() !== 'string') { + throw new Error('gatewayVip must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/reset'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (gatewayVip !== null && gatewayVip !== undefined) { + queryParameters.push('gatewayVip=' + encodeURIComponent(gatewayVip)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['VirtualNetworkGateway']().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); + }); +} + +/** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, 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.'); + } + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnclientpackage'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['VpnClientParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, 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.'); + } + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/generatevpnprofile'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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['VpnClientParameters']().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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnprofilepackageurl'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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 = { + required: false, + serializedName: 'parsedResponse', + type: { + name: 'String' + } + }; + 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); + }); +} + +/** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 BgpPeerStatusListResult} 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 _beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, 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 peer = (options && options.peer !== undefined) ? options.peer : undefined; + // 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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (peer !== null && peer !== undefined && typeof peer.valueOf() !== 'string') { + throw new Error('peer must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getBgpPeerStatus'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (peer !== null && peer !== undefined) { + queryParameters.push('peer=' + encodeURIComponent(peer)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['BgpPeerStatusListResult']().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); + }); +} + +/** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 GatewayRouteListResult} 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 _beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getLearnedRoutes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['GatewayRouteListResult']().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); + }); +} + +/** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 GatewayRouteListResult} 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 _beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (peer === null || peer === undefined || typeof peer.valueOf() !== 'string') { + throw new Error('peer cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getAdvertisedRoutes'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('peer=' + encodeURIComponent(peer)); + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + 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['GatewayRouteListResult']().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); + }); +} + +/** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 VpnClientIPsecParameters} 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 _beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (vpnclientIpsecParams === null || vpnclientIpsecParams === undefined) { + throw new Error('vpnclientIpsecParams cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/setvpnclientipsecparameters'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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 (vpnclientIpsecParams !== null && vpnclientIpsecParams !== undefined) { + let requestModelMapper = new client.models['VpnClientIPsecParameters']().mapper(); + requestModel = client.serialize(requestModelMapper, vpnclientIpsecParams, 'vpnclientIpsecParams'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(vpnclientIpsecParams, 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['VpnClientIPsecParameters']().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); + }); +} + +/** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 VpnClientIPsecParameters} 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 _beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, 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 (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 (virtualNetworkGatewayName === null || virtualNetworkGatewayName === undefined || typeof virtualNetworkGatewayName.valueOf() !== 'string') { + throw new Error('virtualNetworkGatewayName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/getvpnclientipsecparameters'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkGatewayName}', encodeURIComponent(virtualNetworkGatewayName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.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]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VpnClientIPsecParameters']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all virtual network gateways by resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all the connections in a virtual network gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkGatewayListConnectionsResult} + * 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 _listConnectionsNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkGatewayListConnectionsResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a VirtualNetworkGateways. */ +class VirtualNetworkGateways { + /** + * Create a VirtualNetworkGateways. + * @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._listConnections = _listConnections; + this._reset = _reset; + this._generatevpnclientpackage = _generatevpnclientpackage; + this._generateVpnProfile = _generateVpnProfile; + this._getVpnProfilePackageUrl = _getVpnProfilePackageUrl; + this._getBgpPeerStatus = _getBgpPeerStatus; + this._supportedVpnDevices = _supportedVpnDevices; + this._getLearnedRoutes = _getLearnedRoutes; + this._getAdvertisedRoutes = _getAdvertisedRoutes; + this._setVpnclientIpsecParameters = _setVpnclientIpsecParameters; + this._getVpnclientIpsecParameters = _getVpnclientIpsecParameters; + this._vpnDeviceConfigurationScript = _vpnDeviceConfigurationScript; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginUpdateTags = _beginUpdateTags; + this._beginReset = _beginReset; + this._beginGeneratevpnclientpackage = _beginGeneratevpnclientpackage; + this._beginGenerateVpnProfile = _beginGenerateVpnProfile; + this._beginGetVpnProfilePackageUrl = _beginGetVpnProfilePackageUrl; + this._beginGetBgpPeerStatus = _beginGetBgpPeerStatus; + this._beginGetLearnedRoutes = _beginGetLearnedRoutes; + this._beginGetAdvertisedRoutes = _beginGetAdvertisedRoutes; + this._beginSetVpnclientIpsecParameters = _beginSetVpnclientIpsecParameters; + this._beginGetVpnclientIpsecParameters = _beginGetVpnclientIpsecParameters; + this._listNext = _listNext; + this._listConnectionsNext = _listConnectionsNext; + } + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkGatewayName, 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 virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetworkGateway} - 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets the specified virtual network gateway by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified virtual network gateway by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {VirtualNetworkGateway} - 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGateway} - 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayListResult} - 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 VirtualNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + listConnectionsWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listConnections(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {VirtualNetworkGatewayListConnectionsResult} - 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 VirtualNetworkGatewayListConnectionsResult} + * 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. + */ + listConnections(resourceGroupName, virtualNetworkGatewayName, 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._listConnections(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listConnections(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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. + */ + resetWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._reset(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 {VirtualNetworkGateway} - 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 VirtualNetworkGateway} 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. + */ + reset(resourceGroupName, virtualNetworkGatewayName, 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._reset(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._reset(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + generatevpnclientpackageWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, 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._generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + generateVpnProfileWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._generateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + generateVpnProfile(resourceGroupName, virtualNetworkGatewayName, 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._generateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._generateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + getVpnProfilePackageUrlWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + getVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, 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._getVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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. + */ + getBgpPeerStatusWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 {BgpPeerStatusListResult} - 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 BgpPeerStatusListResult} 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. + */ + getBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, 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._getBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Gets a xml format representation for supported vpn devices. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + supportedVpnDevicesWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a xml format representation for supported vpn devices. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, 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._supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + getLearnedRoutesWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {GatewayRouteListResult} - 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 GatewayRouteListResult} 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. + */ + getLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, 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._getLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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. + */ + getAdvertisedRoutesWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, peer, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 {GatewayRouteListResult} - 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 GatewayRouteListResult} 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. + */ + getAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, 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._getAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, optionalCallback); + } + } + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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. + */ + setVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._setVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 {VpnClientIPsecParameters} - 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 VpnClientIPsecParameters} 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. + */ + setVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, 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._setVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._setVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, optionalCallback); + } + } + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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. + */ + getVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 {VpnClientIPsecParameters} - 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 VpnClientIPsecParameters} 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. + */ + getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, 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._getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._getVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Gets a xml format representation for vpn device configuration script. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection for which the configuration script is generated. + * + * @param {object} parameters Parameters supplied to the generate vpn device + * script operation. + * + * @param {string} [parameters.vendor] The vendor for the vpn device. + * + * @param {string} [parameters.deviceFamily] The device family for the vpn + * device. + * + * @param {string} [parameters.firmwareVersion] The firmware version for the + * vpn device. + * + * @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. + */ + vpnDeviceConfigurationScriptWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._vpnDeviceConfigurationScript(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets a xml format representation for vpn device configuration script. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayConnectionName The name of the virtual + * network gateway connection for which the configuration script is generated. + * + * @param {object} parameters Parameters supplied to the generate vpn device + * script operation. + * + * @param {string} [parameters.vendor] The vendor for the vpn device. + * + * @param {string} [parameters.deviceFamily] The device family for the vpn + * device. + * + * @param {string} [parameters.firmwareVersion] The firmware version for the + * vpn device. + * + * @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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + vpnDeviceConfigurationScript(resourceGroupName, virtualNetworkGatewayConnectionName, 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._vpnDeviceConfigurationScript(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._vpnDeviceConfigurationScript(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, options, optionalCallback); + } + } + + /** + * Creates or updates a virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, 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 virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to create or update virtual + * network gateway operation. + * + * @param {array} [parameters.ipConfigurations] IP configurations for virtual + * network gateway. + * + * @param {string} [parameters.gatewayType] The type of this virtual network + * gateway. Possible values are: 'Vpn' and 'ExpressRoute'. Possible values + * include: 'Vpn', 'ExpressRoute' + * + * @param {string} [parameters.vpnType] The type of this virtual network + * gateway. Possible values are: 'PolicyBased' and 'RouteBased'. Possible + * values include: 'PolicyBased', 'RouteBased' + * + * @param {boolean} [parameters.enableBgp] Whether BGP is enabled for this + * virtual network gateway or not. + * + * @param {boolean} [parameters.activeActive] ActiveActive flag + * + * @param {object} [parameters.gatewayDefaultSite] The reference of the + * LocalNetworkGateway resource which represents local network site having + * default routes. Assign Null value in case of removing existing default site + * setting. + * + * @param {string} [parameters.gatewayDefaultSite.id] Resource ID. + * + * @param {object} [parameters.sku] The reference of the + * VirtualNetworkGatewaySku resource which represents the SKU selected for + * Virtual network gateway. + * + * @param {string} [parameters.sku.name] Gateway SKU name. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {string} [parameters.sku.tier] Gateway SKU tier. Possible values + * include: 'Basic', 'HighPerformance', 'Standard', 'UltraPerformance', + * 'VpnGw1', 'VpnGw2', 'VpnGw3' + * + * @param {number} [parameters.sku.capacity] The capacity. + * + * @param {object} [parameters.vpnClientConfiguration] The reference of the + * VpnClientConfiguration resource which represents the P2S VpnClient + * configurations. + * + * @param {object} [parameters.vpnClientConfiguration.vpnClientAddressPool] The + * reference of the address space resource which represents Address space for + * P2S VpnClient. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientAddressPool.addressPrefixes] A + * list of address blocks reserved for this virtual network in CIDR notation. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientRootCertificates] + * VpnClientRootCertificate for virtual network gateway. + * + * @param {array} + * [parameters.vpnClientConfiguration.vpnClientRevokedCertificates] + * VpnClientRevokedCertificate for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientProtocols] + * VpnClientProtocols for Virtual network gateway. + * + * @param {array} [parameters.vpnClientConfiguration.vpnClientIpsecPolicies] + * VpnClientIpsecPolicies for virtual network gateway P2S client. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerAddress] The + * radius server address property of the VirtualNetworkGateway resource for vpn + * client connection. + * + * @param {string} [parameters.vpnClientConfiguration.radiusServerSecret] The + * radius secret property of the VirtualNetworkGateway resource for vpn client + * connection. + * + * @param {object} [parameters.bgpSettings] Virtual network gateway's BGP + * speaker settings. + * + * @param {number} [parameters.bgpSettings.asn] The BGP speaker's ASN. + * + * @param {string} [parameters.bgpSettings.bgpPeeringAddress] The BGP peering + * address and BGP identifier of this BGP speaker. + * + * @param {number} [parameters.bgpSettings.peerWeight] The weight added to + * routes learned from this BGP speaker. + * + * @param {string} [parameters.resourceGuid] The resource GUID property of the + * VirtualNetworkGateway resource. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetworkGateway} - 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network gateway. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network gateway tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to update virtual network + * gateway tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGateway} - 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 VirtualNetworkGateway} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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. + */ + beginResetWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginReset(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Resets the primary of the virtual network gateway in the specified resource + * group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.gatewayVip] Virtual network gateway vip address + * supplied to the begin reset of the active-active feature enabled gateway. + * + * @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 {VirtualNetworkGateway} - 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 VirtualNetworkGateway} 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. + */ + beginReset(resourceGroupName, virtualNetworkGatewayName, 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._beginReset(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginReset(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + beginGeneratevpnclientpackageWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Generates VPN client package for P2S client of the virtual network gateway + * in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, 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._beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGeneratevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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. + */ + beginGenerateVpnProfileWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Generates VPN profile for P2S client of the virtual network gateway in the + * specified resource group. Used for IKEV2 and radius based authentication. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} parameters Parameters supplied to the generate virtual + * network gateway VPN client package operation. + * + * @param {string} [parameters.processorArchitecture] VPN client Processor + * Architecture. Possible values are: 'AMD64' and 'X86'. Possible values + * include: 'Amd64', 'X86' + * + * @param {string} [parameters.authenticationMethod] VPN client Authentication + * Method. Possible values are: 'EAPTLS' and 'EAPMSCHAPv2'. Possible values + * include: 'EAPTLS', 'EAPMSCHAPv2' + * + * @param {string} [parameters.radiusServerAuthCertificate] The public + * certificate data for the radius server authentication certificate as a + * Base-64 encoded string. Required only if external radius authentication has + * been configured with EAPTLS authentication. + * + * @param {array} [parameters.clientRootCertificates] A list of client root + * certificates public certificate data encoded as Base-64 strings. Optional + * parameter for external radius based authentication with EAPTLS. + * + * @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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, 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._beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGenerateVpnProfile(resourceGroupName, virtualNetworkGatewayName, parameters, options, optionalCallback); + } + } + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + beginGetVpnProfilePackageUrlWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets pre-generated VPN profile for P2S client of the virtual network gateway + * in the specified resource group. The profile needs to be generated first + * using generateVpnProfile. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {String} - 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. + * + * {string} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, 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._beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetVpnProfilePackageUrl(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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. + */ + beginGetBgpPeerStatusWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The GetBgpPeerStatus operation retrieves the status of all BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.peer] The IP address of the peer to retrieve the + * status of. + * + * @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 {BgpPeerStatusListResult} - 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 BgpPeerStatusListResult} 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. + */ + beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, 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._beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetBgpPeerStatus(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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. + */ + beginGetLearnedRoutesWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This operation retrieves a list of routes the virtual network gateway has + * learned, including routes learned from BGP peers. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * 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 {GatewayRouteListResult} - 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 GatewayRouteListResult} 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. + */ + beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, 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._beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetLearnedRoutes(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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. + */ + beginGetAdvertisedRoutesWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, peer, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * This operation retrieves a list of routes the virtual network gateway is + * advertising to the specified peer. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {string} peer The IP address of the peer + * + * @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 {GatewayRouteListResult} - 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 GatewayRouteListResult} 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. + */ + beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, 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._beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetAdvertisedRoutes(resourceGroupName, virtualNetworkGatewayName, peer, options, optionalCallback); + } + } + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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. + */ + beginSetVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy + * for P2S client of virtual network gateway in the specified resource group + * through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The name of the virtual network + * gateway. + * + * @param {object} vpnclientIpsecParams Parameters supplied to the Begin Set + * vpnclient ipsec parameters of Virtual Network Gateway P2S client operation + * through Network resource provider. + * + * @param {number} vpnclientIpsecParams.saLifeTimeSeconds The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) lifetime in seconds for + * P2S client. + * + * @param {number} vpnclientIpsecParams.saDataSizeKilobytes The IPSec Security + * Association (also called Quick Mode or Phase 2 SA) payload size in KB for + * P2S client.. + * + * @param {string} vpnclientIpsecParams.ipsecEncryption The IPSec encryption + * algorithm (IKE phase 1). Possible values include: 'None', 'DES', 'DES3', + * 'AES128', 'AES192', 'AES256', 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ipsecIntegrity The IPSec integrity + * algorithm (IKE phase 1). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'GCMAES128', 'GCMAES192', 'GCMAES256' + * + * @param {string} vpnclientIpsecParams.ikeEncryption The IKE encryption + * algorithm (IKE phase 2). Possible values include: 'DES', 'DES3', 'AES128', + * 'AES192', 'AES256', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.ikeIntegrity The IKE integrity + * algorithm (IKE phase 2). Possible values include: 'MD5', 'SHA1', 'SHA256', + * 'SHA384', 'GCMAES256', 'GCMAES128' + * + * @param {string} vpnclientIpsecParams.dhGroup The DH Groups used in IKE Phase + * 1 for initial SA. Possible values include: 'None', 'DHGroup1', 'DHGroup2', + * 'DHGroup14', 'DHGroup2048', 'ECP256', 'ECP384', 'DHGroup24' + * + * @param {string} vpnclientIpsecParams.pfsGroup The Pfs Groups used in IKE + * Phase 2 for new child SA. Possible values include: 'None', 'PFS1', 'PFS2', + * 'PFS2048', 'ECP256', 'ECP384', 'PFS24', 'PFS14', 'PFSMM' + * + * @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 {VpnClientIPsecParameters} - 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 VpnClientIPsecParameters} 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. + */ + beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, 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._beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams, options, optionalCallback); + } + } + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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. + */ + beginGetVpnclientIpsecParametersWithHttpOperationResponse(resourceGroupName, virtualNetworkGatewayName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * The Get VpnclientIpsecParameters operation retrieves information about the + * vpnclient ipsec policy for P2S client of virtual network gateway in the + * specified resource group through Network resource provider. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkGatewayName The virtual network gateway name. + * + * @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 {VpnClientIPsecParameters} - 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 VpnClientIPsecParameters} 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. + */ + beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, 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._beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginGetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, options, optionalCallback); + } + } + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual network gateways by resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayListResult} - 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 VirtualNetworkGatewayListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listConnectionsNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listConnectionsNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all the connections in a virtual network gateway. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkGatewayListConnectionsResult} - 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 VirtualNetworkGatewayListConnectionsResult} + * 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. + */ + listConnectionsNext(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._listConnectionsNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listConnectionsNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualNetworkGateways; diff --git a/lib/services/networkManagement2/lib/lib/operations/virtualNetworkPeerings.js b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkPeerings.js new file mode 100644 index 0000000000..2bf0999f6b --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/virtualNetworkPeerings.js @@ -0,0 +1,1883 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (virtualNetworkPeeringName === null || virtualNetworkPeeringName === undefined || typeof virtualNetworkPeeringName.valueOf() !== 'string') { + throw new Error('virtualNetworkPeeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{virtualNetworkPeeringName}', encodeURIComponent(virtualNetworkPeeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, 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['VirtualNetworkPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 VirtualNetworkPeeringListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, virtualNetworkName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkPeeringListResult']().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 virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (virtualNetworkPeeringName === null || virtualNetworkPeeringName === undefined || typeof virtualNetworkPeeringName.valueOf() !== 'string') { + throw new Error('virtualNetworkPeeringName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{virtualNetworkPeeringName}', encodeURIComponent(virtualNetworkPeeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (virtualNetworkPeeringName === null || virtualNetworkPeeringName === undefined || typeof virtualNetworkPeeringName.valueOf() !== 'string') { + throw new Error('virtualNetworkPeeringName cannot be null or undefined and it must be of type string.'); + } + if (virtualNetworkPeeringParameters === null || virtualNetworkPeeringParameters === undefined) { + throw new Error('virtualNetworkPeeringParameters cannot be null or undefined.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{virtualNetworkPeeringName}', encodeURIComponent(virtualNetworkPeeringName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (virtualNetworkPeeringParameters !== null && virtualNetworkPeeringParameters !== undefined) { + let requestModelMapper = new client.models['VirtualNetworkPeering']().mapper(); + requestModel = client.serialize(requestModelMapper, virtualNetworkPeeringParameters, 'virtualNetworkPeeringParameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(virtualNetworkPeeringParameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkPeering']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkPeering']().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); + }); +} + +/** + * Gets all virtual network peerings in a virtual network. + * + * @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 VirtualNetworkPeeringListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkPeeringListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a VirtualNetworkPeerings. */ +class VirtualNetworkPeerings { + /** + * Create a VirtualNetworkPeerings. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._list = _list; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._listNext = _listNext; + } + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback); + } + } + + /** + * Gets the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @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 {VirtualNetworkPeering} - 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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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. + */ + createOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, 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 peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 {VirtualNetworkPeering} - 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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, optionalCallback); + } + } + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {VirtualNetworkPeeringListResult} - 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 VirtualNetworkPeeringListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, virtualNetworkName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network peering. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the virtual network + * peering. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, options, optionalCallback); + } + } + + /** + * Creates or updates a peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, 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 peering in the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {string} virtualNetworkPeeringName The name of the peering. + * + * @param {object} virtualNetworkPeeringParameters Parameters supplied to the + * create or update virtual network peering operation. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowVirtualNetworkAccess] + * Whether the VMs in the linked virtual network space would be able to access + * all the VMs in local Virtual network space. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowForwardedTraffic] + * Whether the forwarded traffic from the VMs in the remote virtual network + * will be allowed/disallowed. + * + * @param {boolean} [virtualNetworkPeeringParameters.allowGatewayTransit] If + * gateway links can be used in remote virtual networking to link to this + * virtual network. + * + * @param {boolean} [virtualNetworkPeeringParameters.useRemoteGateways] If + * remote gateways can be used on this virtual network. If the flag is set to + * true, and allowGatewayTransit on remote peering is also true, virtual + * network will use gateways of remote virtual network for transit. Only one + * peering can have this flag set to true. This flag cannot be set if virtual + * network already has a gateway. + * + * @param {object} [virtualNetworkPeeringParameters.remoteVirtualNetwork] The + * reference of the remote virtual network. The remote virtual network can be + * in the same or different region (preview). See here to register for the + * preview and learn more + * (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). + * + * @param {string} [virtualNetworkPeeringParameters.remoteVirtualNetwork.id] + * Resource ID. + * + * @param {object} [virtualNetworkPeeringParameters.remoteAddressSpace] The + * reference of the remote virtual network address space. + * + * @param {array} + * [virtualNetworkPeeringParameters.remoteAddressSpace.addressPrefixes] A list + * of address blocks reserved for this virtual network in CIDR notation. + * + * @param {string} [virtualNetworkPeeringParameters.peeringState] The status of + * the virtual network peering. Possible values are 'Initiated', 'Connected', + * and 'Disconnected'. Possible values include: 'Initiated', 'Connected', + * 'Disconnected' + * + * @param {string} [virtualNetworkPeeringParameters.provisioningState] The + * provisioning state of the resource. + * + * @param {string} [virtualNetworkPeeringParameters.name] The name of the + * resource that is unique within a resource group. This name can be used to + * access the resource. + * + * @param {string} [virtualNetworkPeeringParameters.etag] A unique read-only + * string that changes whenever the resource is updated. + * + * @param {string} [virtualNetworkPeeringParameters.id] Resource 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 {VirtualNetworkPeering} - 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 VirtualNetworkPeering} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, options, optionalCallback); + } + } + + /** + * Gets all virtual network peerings in a virtual network. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual network peerings in a virtual network. + * + * @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 {VirtualNetworkPeeringListResult} - 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 VirtualNetworkPeeringListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualNetworkPeerings; diff --git a/lib/services/networkManagement2/lib/lib/operations/virtualNetworks.js b/lib/services/networkManagement2/lib/lib/operations/virtualNetworks.js new file mode 100644 index 0000000000..412ea8f563 --- /dev/null +++ b/lib/services/networkManagement2/lib/lib/operations/virtualNetworks.js @@ -0,0 +1,3360 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is + * regenerated. + */ + +'use strict'; + +const msRest = require('ms-rest'); +const msRestAzure = require('ms-rest-azure'); +const WebResource = msRest.WebResource; + + +/** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _deleteMethod(resourceGroupName, virtualNetworkName, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginDeleteMethod(resourceGroupName, virtualNetworkName, options, (err, parsedResult, httpRequest, response) => { + if (err) return callback(err); + + let initialResult = new msRest.HttpOperationResponse(); + initialResult.request = httpRequest; + initialResult.response = response; + initialResult.body = response.body; + client.getLongRunningOperationResult(initialResult, options, (err, pollingResult) => { + if (err) return callback(err); + + // Create Result + let result = null; + + httpRequest = pollingResult.request; + response = pollingResult.response; + let responseBody = pollingResult.body; + if (responseBody === '') responseBody = null; + + // Deserialize Response + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets the specified virtual network by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _get(resourceGroupName, virtualNetworkName, 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 expand = (options && options.expand !== undefined) ? options.expand : undefined; + // 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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (expand !== null && expand !== undefined && typeof expand.valueOf() !== 'string') { + throw new Error('expand 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/virtualNetworks/{virtualNetworkName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (expand !== null && expand !== undefined) { + queryParameters.push('$expand=' + encodeURIComponent(expand)); + } + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + + +/** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _createOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginCreateOrUpdate(resourceGroupName, virtualNetworkName, 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['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + + +/** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _updateTags(resourceGroupName, virtualNetworkName, parameters, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + + if (!callback) { + throw new Error('callback cannot be null.'); + } + + // Send request + this.beginUpdateTags(resourceGroupName, virtualNetworkName, 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['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + + return callback(null, result, httpRequest, response); + }); + }); +} + +/** + * Gets all virtual networks in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} 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 _listAll(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 (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks'; + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all virtual networks in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _list(resourceGroupName, 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 (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListResult']().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); + }); +} + +/** + * Checks whether a private IP address is available for use. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ipAddress] The private IP address to be verified. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @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 IPAddressAvailabilityResult} 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 _checkIPAddressAvailability(resourceGroupName, virtualNetworkName, 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 ipAddress = (options && options.ipAddress !== undefined) ? options.ipAddress : undefined; + // Validate + try { + if (ipAddress !== null && ipAddress !== undefined && typeof ipAddress.valueOf() !== 'string') { + throw new Error('ipAddress must be of type string.'); + } + if (resourceGroupName === null || resourceGroupName === undefined || typeof resourceGroupName.valueOf() !== 'string') { + throw new Error('resourceGroupName cannot be null or undefined and it must be of type string.'); + } + if (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + if (ipAddress !== null && ipAddress !== undefined) { + queryParameters.push('ipAddress=' + encodeURIComponent(ipAddress)); + } + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['IPAddressAvailabilityResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists usage stats. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 VirtualNetworkListUsageResult} 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 _listUsage(resourceGroupName, virtualNetworkName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListUsageResult']().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 virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginDeleteMethod(resourceGroupName, virtualNetworkName, 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 (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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName cannot be null or undefined and it must be of type string.'); + } + if (this.client.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'DELETE'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 202 && statusCode !== 204) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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} 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginCreateOrUpdate(resourceGroupName, virtualNetworkName, 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.'); + } + // 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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PUT'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['VirtualNetwork']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200 && statusCode !== 201) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + // Deserialize Response + if (statusCode === 201) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError1 = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError1.request = msRest.stripRequest(httpRequest); + deserializationError1.response = msRest.stripResponse(response); + return callback(deserializationError1); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _beginUpdateTags(resourceGroupName, virtualNetworkName, 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.'); + } + // 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 (virtualNetworkName === null || virtualNetworkName === undefined || typeof virtualNetworkName.valueOf() !== 'string') { + throw new Error('virtualNetworkName 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.apiVersion === null || this.client.apiVersion === undefined || typeof this.client.apiVersion.valueOf() !== 'string') { + throw new Error('this.client.apiVersion cannot be null or undefined and it must be of type string.'); + } + if (this.client.subscriptionId === null || this.client.subscriptionId === undefined || typeof this.client.subscriptionId.valueOf() !== 'string') { + throw new Error('this.client.subscriptionId cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let baseUrl = this.client.baseUri; + let requestUrl = baseUrl + (baseUrl.endsWith('/') ? '' : '/') + 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}'; + requestUrl = requestUrl.replace('{resourceGroupName}', encodeURIComponent(resourceGroupName)); + requestUrl = requestUrl.replace('{virtualNetworkName}', encodeURIComponent(virtualNetworkName)); + requestUrl = requestUrl.replace('{subscriptionId}', encodeURIComponent(this.client.subscriptionId)); + let queryParameters = []; + queryParameters.push('api-version=' + encodeURIComponent(this.client.apiVersion)); + if (queryParameters.length > 0) { + requestUrl += '?' + queryParameters.join('&'); + } + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'PATCH'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + // Serialize Request + let requestContent = null; + let requestModel = null; + try { + if (parameters !== null && parameters !== undefined) { + let requestModelMapper = new client.models['TagsObject']().mapper(); + requestModel = client.serialize(requestModelMapper, parameters, 'parameters'); + requestContent = JSON.stringify(requestModel); + } + } catch (error) { + let serializationError = new Error(`Error "${error.message}" occurred in serializing the ` + + `payload - ${JSON.stringify(parameters, null, 2)}.`); + return callback(serializationError); + } + httpRequest.body = requestContent; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetwork']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all virtual networks in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} 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 _listAllNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Gets all virtual networks in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} callback - The callback. + * + * @returns {function} callback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {object} [result] - The deserialized result object if an error did not occur. + * See {@link VirtualNetworkListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ +function _listNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** + * Lists usage stats. + * + * @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 VirtualNetworkListUsageResult} 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 _listUsageNext(nextPageLink, options, callback) { + /* jshint validthis: true */ + let client = this.client; + if(!callback && typeof options === 'function') { + callback = options; + options = null; + } + if (!callback) { + throw new Error('callback cannot be null.'); + } + // Validate + try { + if (nextPageLink === null || nextPageLink === undefined || typeof nextPageLink.valueOf() !== 'string') { + throw new Error('nextPageLink cannot be null or undefined and it must be of type string.'); + } + if (this.client.acceptLanguage !== null && this.client.acceptLanguage !== undefined && typeof this.client.acceptLanguage.valueOf() !== 'string') { + throw new Error('this.client.acceptLanguage must be of type string.'); + } + } catch (error) { + return callback(error); + } + + // Construct URL + let requestUrl = '{nextLink}'; + requestUrl = requestUrl.replace('{nextLink}', nextPageLink); + + // Create HTTP transport objects + let httpRequest = new WebResource(); + httpRequest.method = 'GET'; + httpRequest.url = requestUrl; + httpRequest.headers = {}; + // Set Headers + httpRequest.headers['Content-Type'] = 'application/json; charset=utf-8'; + if (this.client.generateClientRequestId) { + httpRequest.headers['x-ms-client-request-id'] = msRestAzure.generateUuid(); + } + if (this.client.acceptLanguage !== undefined && this.client.acceptLanguage !== null) { + httpRequest.headers['accept-language'] = this.client.acceptLanguage; + } + if(options) { + for(let headerName in options['customHeaders']) { + if (options['customHeaders'].hasOwnProperty(headerName)) { + httpRequest.headers[headerName] = options['customHeaders'][headerName]; + } + } + } + httpRequest.body = null; + // Send Request + return client.pipeline(httpRequest, (err, response, responseBody) => { + if (err) { + return callback(err); + } + let statusCode = response.statusCode; + if (statusCode !== 200) { + let error = new Error(responseBody); + error.statusCode = response.statusCode; + error.request = msRest.stripRequest(httpRequest); + error.response = msRest.stripResponse(response); + if (responseBody === '') responseBody = null; + let parsedErrorResponse; + try { + parsedErrorResponse = JSON.parse(responseBody); + if (parsedErrorResponse) { + if (parsedErrorResponse.error) parsedErrorResponse = parsedErrorResponse.error; + if (parsedErrorResponse.code) error.code = parsedErrorResponse.code; + if (parsedErrorResponse.message) error.message = parsedErrorResponse.message; + } + if (parsedErrorResponse !== null && parsedErrorResponse !== undefined) { + let resultMapper = new client.models['CloudError']().mapper(); + error.body = client.deserialize(resultMapper, parsedErrorResponse, 'error.body'); + } + } catch (defaultError) { + error.message = `Error "${defaultError.message}" occurred in deserializing the responseBody ` + + `- "${responseBody}" for the default response.`; + return callback(error); + } + return callback(error); + } + // Create Result + let result = null; + if (responseBody === '') responseBody = null; + // Deserialize Response + if (statusCode === 200) { + let parsedResponse = null; + try { + parsedResponse = JSON.parse(responseBody); + result = JSON.parse(responseBody); + if (parsedResponse !== null && parsedResponse !== undefined) { + let resultMapper = new client.models['VirtualNetworkListUsageResult']().mapper(); + result = client.deserialize(resultMapper, parsedResponse, 'result'); + } + } catch (error) { + let deserializationError = new Error(`Error ${error} occurred in deserializing the responseBody - ${responseBody}`); + deserializationError.request = msRest.stripRequest(httpRequest); + deserializationError.response = msRest.stripResponse(response); + return callback(deserializationError); + } + } + + return callback(null, result, httpRequest, response); + }); +} + +/** Class representing a VirtualNetworks. */ +class VirtualNetworks { + /** + * Create a VirtualNetworks. + * @param {NetworkManagementClient} client Reference to the service client. + */ + constructor(client) { + this.client = client; + this._deleteMethod = _deleteMethod; + this._get = _get; + this._createOrUpdate = _createOrUpdate; + this._updateTags = _updateTags; + this._listAll = _listAll; + this._list = _list; + this._checkIPAddressAvailability = _checkIPAddressAvailability; + this._listUsage = _listUsage; + this._beginDeleteMethod = _beginDeleteMethod; + this._beginCreateOrUpdate = _beginCreateOrUpdate; + this._beginUpdateTags = _beginUpdateTags; + this._listAllNext = _listAllNext; + this._listNext = _listNext; + this._listUsageNext = _listUsageNext; + } + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + deleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + deleteMethod(resourceGroupName, virtualNetworkName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._deleteMethod(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._deleteMethod(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Gets the specified virtual network by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + getWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets the specified virtual network by resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.expand] Expands referenced resources. + * + * @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 {VirtualNetwork} - 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + get(resourceGroupName, virtualNetworkName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._get(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._get(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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, virtualNetworkName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, 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 virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetwork} - 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + createOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._createOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._createOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback); + } + } + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + updateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetwork} - 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + updateTags(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._updateTags(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._updateTags(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback); + } + } + + /** + * Gets all virtual networks in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllWithHttpOperationResponse(options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAll(options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual networks in a subscription. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkListResult} - 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 VirtualNetworkListResult} 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. + */ + listAll(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._listAll(options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAll(options, optionalCallback); + } + } + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listWithHttpOperationResponse(resourceGroupName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkListResult} - 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 VirtualNetworkListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + list(resourceGroupName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._list(resourceGroupName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._list(resourceGroupName, options, optionalCallback); + } + } + + /** + * Checks whether a private IP address is available for use. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ipAddress] The private IP address to be verified. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + checkIPAddressAvailabilityWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Checks whether a private IP address is available for use. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {string} [options.ipAddress] The private IP address to be verified. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @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 {IPAddressAvailabilityResult} - 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 IPAddressAvailabilityResult} 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. + */ + checkIPAddressAvailability(resourceGroupName, virtualNetworkName, 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._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._checkIPAddressAvailability(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Lists usage stats. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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. + */ + listUsageWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listUsage(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists usage stats. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @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 {VirtualNetworkListUsageResult} - 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 VirtualNetworkListUsageResult} 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. + */ + listUsage(resourceGroupName, virtualNetworkName, 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._listUsage(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listUsage(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginDeleteMethodWithHttpOperationResponse(resourceGroupName, virtualNetworkName, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Deletes the specified virtual network. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {null} - The deserialized result object. + * + * @reject {Error} - The error object. + * + * {function} optionalCallback(err, result, request, response) + * + * {Error} err - The Error object if an error occurred, null otherwise. + * + * {null} [result] - The deserialized result object if an error did not occur. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginDeleteMethod(resourceGroupName, virtualNetworkName, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginDeleteMethod(resourceGroupName, virtualNetworkName, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginDeleteMethod(resourceGroupName, virtualNetworkName, options, optionalCallback); + } + } + + /** + * Creates or updates a virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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. + */ + beginCreateOrUpdateWithHttpOperationResponse(resourceGroupName, virtualNetworkName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, 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 virtual network in the specified resource group. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to the create or update + * virtual network operation + * + * @param {object} [parameters.addressSpace] The AddressSpace that contains an + * array of IP address ranges that can be used by subnets. + * + * @param {array} [parameters.addressSpace.addressPrefixes] A list of address + * blocks reserved for this virtual network in CIDR notation. + * + * @param {object} [parameters.dhcpOptions] The dhcpOptions that contains an + * array of DNS servers available to VMs deployed in the virtual network. + * + * @param {array} [parameters.dhcpOptions.dnsServers] The list of DNS servers + * IP addresses. + * + * @param {array} [parameters.subnets] A list of subnets in a Virtual Network. + * + * @param {array} [parameters.virtualNetworkPeerings] A list of peerings in a + * Virtual Network. + * + * @param {string} [parameters.resourceGuid] The resourceGuid property of the + * Virtual Network resource. + * + * @param {string} [parameters.provisioningState] The provisioning state of the + * PublicIP resource. Possible values are: 'Updating', 'Deleting', and + * 'Failed'. + * + * @param {boolean} [parameters.enableDdosProtection] Indicates if DDoS + * protection is enabled for all the protected resources in the virtual + * network. It requires a DDoS protection plan associated with the resource. + * + * @param {boolean} [parameters.enableVmProtection] Indicates if VM protection + * is enabled for all the subnets in the virtual network. + * + * @param {object} [parameters.ddosProtectionPlan] The DDoS protection plan + * associated with the virtual network. + * + * @param {string} [parameters.ddosProtectionPlan.id] Resource ID. + * + * @param {string} [parameters.etag] Gets 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 {VirtualNetwork} - 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginCreateOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginCreateOrUpdate(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback); + } + } + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + beginUpdateTagsWithHttpOperationResponse(resourceGroupName, virtualNetworkName, parameters, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Updates a virtual network tags. + * + * @param {string} resourceGroupName The name of the resource group. + * + * @param {string} virtualNetworkName The name of the virtual network. + * + * @param {object} parameters Parameters supplied to update virtual network + * tags. + * + * @param {object} [parameters.tags] Resource tags. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetwork} - 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 VirtualNetwork} for more information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + beginUpdateTags(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._beginUpdateTags(resourceGroupName, virtualNetworkName, parameters, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._beginUpdateTags(resourceGroupName, virtualNetworkName, parameters, options, optionalCallback); + } + } + + /** + * Gets all virtual networks in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listAllNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listAllNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual networks in a subscription. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkListResult} - 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 VirtualNetworkListResult} 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. + */ + listAllNext(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._listAllNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listAllNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @returns {Promise} A promise is returned + * + * @resolve {HttpOperationResponse} - The deserialized result object. + * + * @reject {Error} - The error object. + */ + listNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Gets all virtual networks in a resource group. + * + * @param {string} nextPageLink The NextLink from the previous successful call + * to List operation. + * + * @param {object} [options] Optional Parameters. + * + * @param {object} [options.customHeaders] Headers that will be added to the + * request + * + * @param {function} [optionalCallback] - The optional callback. + * + * @returns {function|Promise} If a callback was passed as the last parameter + * then it returns the callback else returns a Promise. + * + * {Promise} A promise is returned + * + * @resolve {VirtualNetworkListResult} - 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 VirtualNetworkListResult} for more + * information. + * + * {object} [request] - The HTTP Request object if an error did not occur. + * + * {stream} [response] - The HTTP Response stream if an error did not occur. + */ + listNext(nextPageLink, options, optionalCallback) { + let client = this.client; + let self = this; + if (!optionalCallback && typeof options === 'function') { + optionalCallback = options; + options = null; + } + if (!optionalCallback) { + return new Promise((resolve, reject) => { + self._listNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listNext(nextPageLink, options, optionalCallback); + } + } + + /** + * Lists usage stats. + * + * @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. + */ + listUsageNextWithHttpOperationResponse(nextPageLink, options) { + let client = this.client; + let self = this; + return new Promise((resolve, reject) => { + self._listUsageNext(nextPageLink, options, (err, result, request, response) => { + let httpOperationResponse = new msRest.HttpOperationResponse(request, response); + httpOperationResponse.body = result; + if (err) { reject(err); } + else { resolve(httpOperationResponse); } + return; + }); + }); + } + + /** + * Lists usage stats. + * + * @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 {VirtualNetworkListUsageResult} - 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 VirtualNetworkListUsageResult} 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. + */ + listUsageNext(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._listUsageNext(nextPageLink, options, (err, result, request, response) => { + if (err) { reject(err); } + else { resolve(result); } + return; + }); + }); + } else { + return self._listUsageNext(nextPageLink, options, optionalCallback); + } + } + +} + +module.exports = VirtualNetworks; diff --git a/lib/services/networkManagement2/lib/package.json b/lib/services/networkManagement2/lib/package.json new file mode 100644 index 0000000000..dd479f1635 --- /dev/null +++ b/lib/services/networkManagement2/lib/package.json @@ -0,0 +1,22 @@ +{ + "name": "azure-arm-network", + "author": "Microsoft Corporation", + "description": "NetworkManagementClient Library with typescript type definitions for node", + "version": "", + "dependencies": { + "ms-rest": "^2.3.3", + "ms-rest-azure": "^2.5.5" + }, + "keywords": [ "node", "azure" ], + "license": "MIT", + "main": "./lib/networkManagementClient.js", + "types": "./lib/networkManagementClient.d.ts", + "homepage": "http://github.com/azure/azure-sdk-for-node", + "repository": { + "type": "git", + "url": "https://github.com/azure/azure-sdk-for-node.git" + }, + "bugs": { + "url": "http://github.com/Azure/azure-sdk-for-node/issues" + } +}