From f5b4bc37966488ef8421985e0416512f70ab9c20 Mon Sep 17 00:00:00 2001 From: Sachet Hegde Date: Thu, 12 Nov 2020 13:07:36 -0800 Subject: [PATCH] SDK for Network 2020-07-01 --- .../Generated/INetworkInterfacesOperations.cs | 133 ++ .../Generated/IPublicIpAddressesOperations.cs | 147 ++ ...pplicationGatewayAutoscaleConfiguration.cs | 7 +- .../Models/ApplicationGatewayProbe.cs | 15 +- .../ApplicationGatewayRequestRoutingRule.cs | 15 +- ...ewayWebApplicationFirewallConfiguration.cs | 37 +- .../src/Generated/Models/ApplicationRule.cs | 1 + .../AzureFirewallApplicationRuleCollection.cs | 15 +- .../AzureFirewallApplicationRuleProtocol.cs | 15 +- .../Models/AzureFirewallNatRuleCollection.cs | 15 +- .../AzureFirewallNetworkRuleCollection.cs | 15 +- .../AzureReachabilityReportLatencyInfo.cs | 15 +- .../src/Generated/Models/BgpConnection.cs | 15 +- .../src/Generated/Models/BgpPeerStatus.cs | 15 +- .../src/Generated/Models/BgpSettings.cs | 15 +- .../src/Generated/Models/ConnectionMonitor.cs | 15 +- .../Models/ConnectionMonitorDestination.cs | 15 +- .../ConnectionMonitorHttpConfiguration.cs | 15 +- .../Models/ConnectionMonitorParameters.cs | 15 +- .../Models/ConnectionMonitorResult.cs | 15 +- .../Models/ConnectionMonitorSource.cs | 15 +- .../ConnectionMonitorTcpConfiguration.cs | 15 +- .../Models/ConnectionStateSnapshot.cs | 75 +- .../Models/ConnectivityDestination.cs | 15 +- .../Generated/Models/ConnectivitySource.cs | 15 +- .../Models/ExpressRouteCircuitPeering.cs | 15 +- .../Models/ExpressRouteConnection.cs | 11 +- .../ExpressRouteCrossConnectionPeering.cs | 15 +- .../FirewallPolicyFilterRuleCollection.cs | 1 + .../Models/FirewallPolicyNatRuleCollection.cs | 1 + .../Generated/Models/FirewallPolicyRule.cs | 1 + .../FirewallPolicyRuleApplicationProtocol.cs | 15 +- .../Models/FirewallPolicyRuleCollection.cs | 16 +- .../FirewallPolicyRuleCollectionGroup.cs | 15 +- .../src/Generated/Models/HopLink.cs | 45 +- .../Generated/Models/InboundSecurityRules.cs | 15 +- .../src/Generated/Models/NatRule.cs | 1 + .../src/Generated/Models/NetworkRule.cs | 1 + .../Models/NetworkVirtualAppliance.cs | 15 +- .../src/Generated/Models/PacketCapture.cs | 45 +- .../Models/PacketCaptureParameters.cs | 45 +- .../Generated/Models/PacketCaptureResult.cs | 45 +- .../src/Generated/Models/PolicySettings.cs | 22 +- .../src/Generated/Models/VirtualHub.cs | 15 +- .../src/Generated/Models/VirtualRouter.cs | 15 +- .../Generated/Models/VirtualRouterPeering.cs | 15 +- .../Generated/NetworkInterfacesOperations.cs | 1247 +++++++++++++++-- .../NetworkInterfacesOperationsExtensions.cs | 216 +++ .../Generated/PublicIpAddressesOperations.cs | 1237 ++++++++++++++-- .../PublicIpAddressesOperationsExtensions.cs | 240 ++++ .../SdkInfo_NetworkManagementClient.cs | 13 +- .../Microsoft.Azure.Management.Network.csproj | 2 +- .../src/Properties/AssemblyInfo.cs | 2 +- 53 files changed, 3429 insertions(+), 582 deletions(-) diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkInterfacesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkInterfacesOperations.cs index cd895f128c9b3..b81393a3af9a5 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkInterfacesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkInterfacesOperations.cs @@ -383,6 +383,94 @@ public partial interface INetworkInterfacesOperations /// Task> GetVirtualMachineScaleSetIpConfigurationWithHttpMessagesAsync(string resourceGroupName, string virtualMachineScaleSetName, string virtualmachineIndex, string networkInterfaceName, string ipConfigurationName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets information about all network interfaces in a role instance in + /// a cloud service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceRoleInstanceNetworkInterfacesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceNetworkInterfacesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified network interface in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The name of the network interface. + /// + /// + /// Expands referenced resources. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetCloudServiceNetworkInterfaceWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes the specified network interface. /// /// @@ -595,5 +683,50 @@ public partial interface INetworkInterfacesOperations /// Thrown when a required parameter is null /// Task>> ListVirtualMachineScaleSetIpConfigurationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about all network interfaces in a role instance in + /// a cloud service + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceRoleInstanceNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs index 8fda8a2ea5942..6c2e12563dca5 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs @@ -273,6 +273,107 @@ public partial interface IPublicIPAddressesOperations /// Task> GetVirtualMachineScaleSetPublicIPAddressWithHttpMessagesAsync(string resourceGroupName, string virtualMachineScaleSetName, string virtualmachineIndex, string networkInterfaceName, string ipConfigurationName, string publicIpAddressName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets information about all public IP addresses on a cloud service + /// level. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServicePublicIPAddressesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about all public IP addresses in a role instance + /// IP configuration in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The network interface name. + /// + /// + /// The IP configuration name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceRoleInstancePublicIPAddressesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified public IP address in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The role instance name. + /// + /// + /// The name of the network interface. + /// + /// + /// The name of the IP configuration. + /// + /// + /// The name of the public IP Address. + /// + /// + /// Expands referenced resources. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetCloudServicePublicIPAddressWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, string publicIpAddressName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes the specified public IP address. /// /// @@ -413,5 +514,51 @@ public partial interface IPublicIPAddressesOperations /// Thrown when a required parameter is null /// Task>> ListVirtualMachineScaleSetVMPublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about all public IP addresses on a cloud service + /// level. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServicePublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets information about all public IP addresses in a role instance + /// IP configuration in a cloud service. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListCloudServiceRoleInstancePublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayAutoscaleConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayAutoscaleConfiguration.cs index feca79d52be4e..310e30ea48b3a 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayAutoscaleConfiguration.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayAutoscaleConfiguration.cs @@ -72,9 +72,12 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "MinCapacity", 0); } - if (MaxCapacity < 2) + if (MaxCapacity != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxCapacity", 2); + if (MaxCapacity < 2) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxCapacity", 2); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayProbe.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayProbe.cs index 1444f590718f0..de4d798572776 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayProbe.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayProbe.cs @@ -202,13 +202,16 @@ public ApplicationGatewayProbe() /// public virtual void Validate() { - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 1); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 1); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs index 60a8efa151e4a..7b87e43a5fd05 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs @@ -171,13 +171,16 @@ public ApplicationGatewayRequestRoutingRule() /// public virtual void Validate() { - if (Priority > 20000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 20000); - } - if (Priority < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1); + if (Priority > 20000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 20000); + } + if (Priority < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 1); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs index bd4966fd77a98..dad33866910ec 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayWebApplicationFirewallConfiguration.cs @@ -165,25 +165,34 @@ public virtual void Validate() } } } - if (MaxRequestBodySize > 128) + if (MaxRequestBodySize != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySize", 128); - } - if (MaxRequestBodySize < 8) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySize", 8); - } - if (MaxRequestBodySizeInKb > 128) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySizeInKb", 128); + if (MaxRequestBodySize > 128) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySize", 128); + } + if (MaxRequestBodySize < 8) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySize", 8); + } } - if (MaxRequestBodySizeInKb < 8) + if (MaxRequestBodySizeInKb != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySizeInKb", 8); + if (MaxRequestBodySizeInKb > 128) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySizeInKb", 128); + } + if (MaxRequestBodySizeInKb < 8) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySizeInKb", 8); + } } - if (FileUploadLimitInMb < 0) + if (FileUploadLimitInMb != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "FileUploadLimitInMb", 0); + if (FileUploadLimitInMb < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FileUploadLimitInMb", 0); + } } if (Exclusions != null) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRule.cs index caa6a0d598e61..3bfb4fabf638e 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRule.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRule.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Rule of type application. /// + [Newtonsoft.Json.JsonObject("ApplicationRule")] public partial class ApplicationRule : FirewallPolicyRule { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs index 6528bdb761cfe..30fea8c7ada49 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs @@ -116,13 +116,16 @@ public AzureFirewallApplicationRuleCollection() /// public virtual void Validate() { - if (Priority > 65000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); - } - if (Priority < 100) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleProtocol.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleProtocol.cs index f2c9c74fdc194..278a39b679cb1 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleProtocol.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallApplicationRuleProtocol.cs @@ -70,13 +70,16 @@ public AzureFirewallApplicationRuleProtocol() /// public virtual void Validate() { - if (Port > 64000) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 64000); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 64000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 64000); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs index d18672edde1bf..01ffee90b3fdf 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs @@ -116,13 +116,16 @@ public AzureFirewallNatRuleCollection() /// public virtual void Validate() { - if (Priority > 65000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); - } - if (Priority < 100) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs index 00531f0237b25..cb720dc5c385e 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs @@ -115,13 +115,16 @@ public AzureFirewallNetworkRuleCollection() /// public virtual void Validate() { - if (Priority > 65000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); - } - if (Priority < 100) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureReachabilityReportLatencyInfo.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureReachabilityReportLatencyInfo.cs index a204272b613fb..da00b97ff30c3 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureReachabilityReportLatencyInfo.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureReachabilityReportLatencyInfo.cs @@ -68,13 +68,16 @@ public AzureReachabilityReportLatencyInfo() /// public virtual void Validate() { - if (Score > 100) + if (Score != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Score", 100); - } - if (Score < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Score", 1); + if (Score > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Score", 100); + } + if (Score < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Score", 1); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpConnection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpConnection.cs index 9afc670cf39e6..0a2306a862fde 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpConnection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpConnection.cs @@ -116,13 +116,16 @@ public BgpConnection() /// public virtual void Validate() { - if (PeerAsn > 4294967295) + if (PeerAsn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerAsn", 4294967295); - } - if (PeerAsn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerAsn", 0); + if (PeerAsn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerAsn", 4294967295); + } + if (PeerAsn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerAsn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpPeerStatus.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpPeerStatus.cs index 4add761aab2fb..843529d859078 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpPeerStatus.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpPeerStatus.cs @@ -119,13 +119,16 @@ public BgpPeerStatus() /// public virtual void Validate() { - if (Asn > 4294967295) + if (Asn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Asn", 4294967295); - } - if (Asn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Asn", 0); + if (Asn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Asn", 4294967295); + } + if (Asn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Asn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpSettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpSettings.cs index 5e5788fc6e230..7ae62bc4e6bb9 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpSettings.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/BgpSettings.cs @@ -88,13 +88,16 @@ public BgpSettings() /// public virtual void Validate() { - if (Asn > 4294967295) + if (Asn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Asn", 4294967295); - } - if (Asn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Asn", 0); + if (Asn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Asn", 4294967295); + } + if (Asn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Asn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitor.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitor.cs index 0caac861305b3..89593c0c49104 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitor.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitor.cs @@ -158,13 +158,16 @@ public virtual void Validate() { Destination.Validate(); } - if (MonitoringIntervalInSeconds > 1800) + if (MonitoringIntervalInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); - } - if (MonitoringIntervalInSeconds < 30) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + if (MonitoringIntervalInSeconds > 1800) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); + } + if (MonitoringIntervalInSeconds < 30) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + } } if (Endpoints != null) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorDestination.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorDestination.cs index eb4b187b87266..a2c4c891be633 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorDestination.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorDestination.cs @@ -79,13 +79,16 @@ public ConnectionMonitorDestination() /// public virtual void Validate() { - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorHttpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorHttpConfiguration.cs index 7d6e8ebc03e8d..9f52940d25c4e 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorHttpConfiguration.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorHttpConfiguration.cs @@ -110,13 +110,16 @@ public ConnectionMonitorHttpConfiguration() /// public virtual void Validate() { - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorParameters.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorParameters.cs index b4ad6eaafdb19..403ef9585674e 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorParameters.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorParameters.cs @@ -142,13 +142,16 @@ public virtual void Validate() { Destination.Validate(); } - if (MonitoringIntervalInSeconds > 1800) + if (MonitoringIntervalInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); - } - if (MonitoringIntervalInSeconds < 30) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + if (MonitoringIntervalInSeconds > 1800) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); + } + if (MonitoringIntervalInSeconds < 30) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + } } if (Endpoints != null) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorResult.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorResult.cs index 2a49a2fa6b6ab..afe0533ea4c78 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorResult.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorResult.cs @@ -233,13 +233,16 @@ public virtual void Validate() { Destination.Validate(); } - if (MonitoringIntervalInSeconds > 1800) + if (MonitoringIntervalInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); - } - if (MonitoringIntervalInSeconds < 30) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + if (MonitoringIntervalInSeconds > 1800) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MonitoringIntervalInSeconds", 1800); + } + if (MonitoringIntervalInSeconds < 30) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MonitoringIntervalInSeconds", 30); + } } if (Endpoints != null) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorSource.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorSource.cs index b0627a3e13dbc..83bd49a53e0d2 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorSource.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorSource.cs @@ -71,13 +71,16 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); } - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorTcpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorTcpConfiguration.cs index 66c4afb87b256..2fe276a1ca7ca 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorTcpConfiguration.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionMonitorTcpConfiguration.cs @@ -78,13 +78,16 @@ public ConnectionMonitorTcpConfiguration() /// public virtual void Validate() { - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionStateSnapshot.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionStateSnapshot.cs index 30b563b24bd9d..fb8bdc77ff245 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionStateSnapshot.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectionStateSnapshot.cs @@ -138,45 +138,60 @@ public ConnectionStateSnapshot() /// public virtual void Validate() { - if (AvgLatencyInMs > 4294967295) + if (AvgLatencyInMs != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "AvgLatencyInMs", 4294967295); + if (AvgLatencyInMs > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "AvgLatencyInMs", 4294967295); + } + if (AvgLatencyInMs < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "AvgLatencyInMs", 0); + } } - if (AvgLatencyInMs < 0) + if (MinLatencyInMs != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "AvgLatencyInMs", 0); + if (MinLatencyInMs > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MinLatencyInMs", 4294967295); + } + if (MinLatencyInMs < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MinLatencyInMs", 0); + } } - if (MinLatencyInMs > 4294967295) + if (MaxLatencyInMs != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MinLatencyInMs", 4294967295); + if (MaxLatencyInMs > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxLatencyInMs", 4294967295); + } + if (MaxLatencyInMs < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxLatencyInMs", 0); + } } - if (MinLatencyInMs < 0) + if (ProbesSent != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MinLatencyInMs", 0); + if (ProbesSent > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ProbesSent", 4294967295); + } + if (ProbesSent < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ProbesSent", 0); + } } - if (MaxLatencyInMs > 4294967295) + if (ProbesFailed != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxLatencyInMs", 4294967295); - } - if (MaxLatencyInMs < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxLatencyInMs", 0); - } - if (ProbesSent > 4294967295) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "ProbesSent", 4294967295); - } - if (ProbesSent < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "ProbesSent", 0); - } - if (ProbesFailed > 4294967295) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "ProbesFailed", 4294967295); - } - if (ProbesFailed < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "ProbesFailed", 0); + if (ProbesFailed > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "ProbesFailed", 4294967295); + } + if (ProbesFailed < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "ProbesFailed", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivityDestination.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivityDestination.cs index 070ecc5f1ead5..f6f519013db79 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivityDestination.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivityDestination.cs @@ -77,13 +77,16 @@ public ConnectivityDestination() /// public virtual void Validate() { - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivitySource.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivitySource.cs index 00e6136a7079e..9115d726b2500 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivitySource.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ConnectivitySource.cs @@ -72,13 +72,16 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); } - if (Port > 65535) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 65535); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCircuitPeering.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCircuitPeering.cs index 207feb5c06e75..5a4692d55c503 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCircuitPeering.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCircuitPeering.cs @@ -265,13 +265,16 @@ public ExpressRouteCircuitPeering() /// public virtual void Validate() { - if (PeerASN > 4294967295) + if (PeerASN != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerASN", 4294967295); - } - if (PeerASN < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerASN", 1); + if (PeerASN > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerASN", 4294967295); + } + if (PeerASN < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerASN", 1); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteConnection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteConnection.cs index 4798065579997..f1262b1c56953 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteConnection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteConnection.cs @@ -45,12 +45,10 @@ public ExpressRouteConnection() /// connection. /// Enable internet /// security. - /// Enable FastPath to vWan - /// Firewall hub. /// The Routing Configuration /// indicating the associated and propagated route tables on this /// connection. - public ExpressRouteConnection(ExpressRouteCircuitPeeringId expressRouteCircuitPeering, string name, string id = default(string), string provisioningState = default(string), string authorizationKey = default(string), int? routingWeight = default(int?), bool? enableInternetSecurity = default(bool?), bool? expressRouteGatewayBypass = default(bool?), RoutingConfiguration routingConfiguration = default(RoutingConfiguration)) + public ExpressRouteConnection(ExpressRouteCircuitPeeringId expressRouteCircuitPeering, string name, string id = default(string), string provisioningState = default(string), string authorizationKey = default(string), int? routingWeight = default(int?), bool? enableInternetSecurity = default(bool?), RoutingConfiguration routingConfiguration = default(RoutingConfiguration)) : base(id) { ProvisioningState = provisioningState; @@ -58,7 +56,6 @@ public ExpressRouteConnection() AuthorizationKey = authorizationKey; RoutingWeight = routingWeight; EnableInternetSecurity = enableInternetSecurity; - ExpressRouteGatewayBypass = expressRouteGatewayBypass; RoutingConfiguration = routingConfiguration; Name = name; CustomInit(); @@ -101,12 +98,6 @@ public ExpressRouteConnection() [JsonProperty(PropertyName = "properties.enableInternetSecurity")] public bool? EnableInternetSecurity { get; set; } - /// - /// Gets or sets enable FastPath to vWan Firewall hub. - /// - [JsonProperty(PropertyName = "properties.expressRouteGatewayBypass")] - public bool? ExpressRouteGatewayBypass { get; set; } - /// /// Gets or sets the Routing Configuration indicating the associated /// and propagated route tables on this connection. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCrossConnectionPeering.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCrossConnectionPeering.cs index 7f0342d94b6b3..2246452167f19 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCrossConnectionPeering.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ExpressRouteCrossConnectionPeering.cs @@ -209,13 +209,16 @@ public ExpressRouteCrossConnectionPeering() /// public virtual void Validate() { - if (PeerASN > 4294967295) + if (PeerASN != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerASN", 4294967295); - } - if (PeerASN < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerASN", 1); + if (PeerASN > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerASN", 4294967295); + } + if (PeerASN < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerASN", 1); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleCollection.cs index f0a93af056342..2184add4699b3 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleCollection.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Firewall Policy Filter Rule Collection. /// + [Newtonsoft.Json.JsonObject("FirewallPolicyFilterRuleCollection")] public partial class FirewallPolicyFilterRuleCollection : FirewallPolicyRuleCollection { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleCollection.cs index 45fc27690fbb1..5466fda21bf39 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleCollection.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Firewall Policy NAT Rule Collection. /// + [Newtonsoft.Json.JsonObject("FirewallPolicyNatRuleCollection")] public partial class FirewallPolicyNatRuleCollection : FirewallPolicyRuleCollection { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs index f56257124f717..ed4b7f977df18 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs @@ -16,6 +16,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Properties of a rule. /// + [Newtonsoft.Json.JsonObject("FirewallPolicyRule")] public partial class FirewallPolicyRule { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleApplicationProtocol.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleApplicationProtocol.cs index cf68f4aa6b544..2bad4a0ff8cff 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleApplicationProtocol.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleApplicationProtocol.cs @@ -70,13 +70,16 @@ public FirewallPolicyRuleApplicationProtocol() /// public virtual void Validate() { - if (Port > 64000) + if (Port != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 64000); - } - if (Port < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + if (Port > 64000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Port", 64000); + } + if (Port < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Port", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollection.cs index 03123f19d0faf..824b73fb84a31 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollection.cs @@ -17,6 +17,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Properties of the rule collection. /// + [Newtonsoft.Json.JsonObject("FirewallPolicyRuleCollection")] public partial class FirewallPolicyRuleCollection { /// @@ -68,13 +69,16 @@ public FirewallPolicyRuleCollection() /// public virtual void Validate() { - if (Priority > 65000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); - } - if (Priority < 100) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroup.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroup.cs index b417d38a1e8c3..3cd122ca0f1d8 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroup.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroup.cs @@ -116,13 +116,16 @@ public FirewallPolicyRuleCollectionGroup() /// public virtual void Validate() { - if (Priority > 65000) + if (Priority != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); - } - if (Priority < 100) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } } if (RuleCollections != null) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs index 64218016af560..cfec5a05915ce 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HopLink.cs @@ -119,29 +119,38 @@ public HopLink() /// public virtual void Validate() { - if (RoundTripTimeMin > 4294967295) + if (RoundTripTimeMin != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeMin", 4294967295); + if (RoundTripTimeMin > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeMin", 4294967295); + } + if (RoundTripTimeMin < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeMin", 0); + } } - if (RoundTripTimeMin < 0) + if (RoundTripTimeAvg != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeMin", 0); + if (RoundTripTimeAvg > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeAvg", 4294967295); + } + if (RoundTripTimeAvg < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeAvg", 0); + } } - if (RoundTripTimeAvg > 4294967295) + if (RoundTripTimeMax != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeAvg", 4294967295); - } - if (RoundTripTimeAvg < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeAvg", 0); - } - if (RoundTripTimeMax > 4294967295) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeMax", 4294967295); - } - if (RoundTripTimeMax < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeMax", 0); + if (RoundTripTimeMax > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "RoundTripTimeMax", 4294967295); + } + if (RoundTripTimeMax < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "RoundTripTimeMax", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs index be9f44b217ffd..133d8fe7975e2 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/InboundSecurityRules.cs @@ -78,13 +78,16 @@ public InboundSecurityRules() /// public virtual void Validate() { - if (DestinationPortRange > 65535) + if (DestinationPortRange != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "DestinationPortRange", 65535); - } - if (DestinationPortRange < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "DestinationPortRange", 0); + if (DestinationPortRange > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "DestinationPortRange", 65535); + } + if (DestinationPortRange < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "DestinationPortRange", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NatRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NatRule.cs index 8fa86e0c99355..8dbc9d3c938ef 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NatRule.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NatRule.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Rule of type nat. /// + [Newtonsoft.Json.JsonObject("NatRule")] public partial class NatRule : FirewallPolicyRule { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRule.cs index 7a0279f4f82ea..feebc1b0ae051 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRule.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRule.cs @@ -18,6 +18,7 @@ namespace Microsoft.Azure.Management.Network.Models /// /// Rule of type network. /// + [Newtonsoft.Json.JsonObject("NetworkRule")] public partial class NetworkRule : FirewallPolicyRule { /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs index e56c23395ae6c..40d6b8c5b9996 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkVirtualAppliance.cs @@ -179,13 +179,16 @@ public NetworkVirtualAppliance() /// public virtual void Validate() { - if (VirtualApplianceAsn > 4294967295) + if (VirtualApplianceAsn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualApplianceAsn", 4294967295); - } - if (VirtualApplianceAsn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualApplianceAsn", 0); + if (VirtualApplianceAsn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualApplianceAsn", 4294967295); + } + if (VirtualApplianceAsn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualApplianceAsn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCapture.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCapture.cs index 270be9f057ac3..0cb6d02efca32 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCapture.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCapture.cs @@ -115,29 +115,38 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "StorageLocation"); } - if (BytesToCapturePerPacket > 4294967295) + if (BytesToCapturePerPacket != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + if (BytesToCapturePerPacket > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + } + if (BytesToCapturePerPacket < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + } } - if (BytesToCapturePerPacket < 0) + if (TotalBytesPerSession != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + if (TotalBytesPerSession > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); + } + if (TotalBytesPerSession < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); + } } - if (TotalBytesPerSession > 4294967295) + if (TimeLimitInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); - } - if (TotalBytesPerSession < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); - } - if (TimeLimitInSeconds > 18000) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); - } - if (TimeLimitInSeconds < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + if (TimeLimitInSeconds > 18000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); + } + if (TimeLimitInSeconds < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureParameters.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureParameters.cs index a8a225ae7b4b6..e791803e4fad6 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureParameters.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureParameters.cs @@ -113,29 +113,38 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "StorageLocation"); } - if (BytesToCapturePerPacket > 4294967295) + if (BytesToCapturePerPacket != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + if (BytesToCapturePerPacket > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + } + if (BytesToCapturePerPacket < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + } } - if (BytesToCapturePerPacket < 0) + if (TotalBytesPerSession != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + if (TotalBytesPerSession > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); + } + if (TotalBytesPerSession < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); + } } - if (TotalBytesPerSession > 4294967295) + if (TimeLimitInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); - } - if (TotalBytesPerSession < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); - } - if (TimeLimitInSeconds > 18000) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); - } - if (TimeLimitInSeconds < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + if (TimeLimitInSeconds > 18000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); + } + if (TimeLimitInSeconds < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureResult.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureResult.cs index cdd1a0f896be6..ed6a805dc78e0 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureResult.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PacketCaptureResult.cs @@ -152,29 +152,38 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "StorageLocation"); } - if (BytesToCapturePerPacket > 4294967295) + if (BytesToCapturePerPacket != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + if (BytesToCapturePerPacket > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "BytesToCapturePerPacket", 4294967295); + } + if (BytesToCapturePerPacket < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + } } - if (BytesToCapturePerPacket < 0) + if (TotalBytesPerSession != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "BytesToCapturePerPacket", 0); + if (TotalBytesPerSession > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); + } + if (TotalBytesPerSession < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); + } } - if (TotalBytesPerSession > 4294967295) + if (TimeLimitInSeconds != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TotalBytesPerSession", 4294967295); - } - if (TotalBytesPerSession < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TotalBytesPerSession", 0); - } - if (TimeLimitInSeconds > 18000) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); - } - if (TimeLimitInSeconds < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + if (TimeLimitInSeconds > 18000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "TimeLimitInSeconds", 18000); + } + if (TimeLimitInSeconds < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "TimeLimitInSeconds", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PolicySettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PolicySettings.cs index 69188a8004887..9ef8318378997 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PolicySettings.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PolicySettings.cs @@ -95,17 +95,23 @@ public PolicySettings() /// public virtual void Validate() { - if (MaxRequestBodySizeInKb > 128) + if (MaxRequestBodySizeInKb != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySizeInKb", 128); + if (MaxRequestBodySizeInKb > 128) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "MaxRequestBodySizeInKb", 128); + } + if (MaxRequestBodySizeInKb < 8) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySizeInKb", 8); + } } - if (MaxRequestBodySizeInKb < 8) + if (FileUploadLimitInMb != null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "MaxRequestBodySizeInKb", 8); - } - if (FileUploadLimitInMb < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "FileUploadLimitInMb", 0); + if (FileUploadLimitInMb < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "FileUploadLimitInMb", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualHub.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualHub.cs index 0f7c9234b6e00..07a717e1743ce 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualHub.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualHub.cs @@ -233,13 +233,16 @@ public VirtualHub() /// public virtual void Validate() { - if (VirtualRouterAsn > 4294967295) + if (VirtualRouterAsn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualRouterAsn", 4294967295); - } - if (VirtualRouterAsn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualRouterAsn", 0); + if (VirtualRouterAsn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualRouterAsn", 4294967295); + } + if (VirtualRouterAsn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualRouterAsn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouter.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouter.cs index 970f9a3fe686c..e6a1b590c68a2 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouter.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouter.cs @@ -122,13 +122,16 @@ public VirtualRouter() /// public virtual void Validate() { - if (VirtualRouterAsn > 4294967295) + if (VirtualRouterAsn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualRouterAsn", 4294967295); - } - if (VirtualRouterAsn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualRouterAsn", 0); + if (VirtualRouterAsn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "VirtualRouterAsn", 4294967295); + } + if (VirtualRouterAsn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "VirtualRouterAsn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouterPeering.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouterPeering.cs index 356b2fda93341..35a8277064c26 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouterPeering.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualRouterPeering.cs @@ -107,13 +107,16 @@ public VirtualRouterPeering() /// public virtual void Validate() { - if (PeerAsn > 4294967295) + if (PeerAsn != null) { - throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerAsn", 4294967295); - } - if (PeerAsn < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerAsn", 0); + if (PeerAsn > 4294967295) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PeerAsn", 4294967295); + } + if (PeerAsn < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PeerAsn", 0); + } } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperations.cs index e80d28f932a89..e4847503291f7 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperations.cs @@ -1981,6 +1981,624 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) return _result; } + /// + /// Gets information about all network interfaces in a role instance in a cloud + /// service + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListCloudServiceRoleInstanceNetworkInterfacesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceRoleInstanceNetworkInterfaces", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListCloudServiceNetworkInterfacesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceNetworkInterfaces", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/networkInterfaces").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified network interface in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The name of the network interface. + /// + /// + /// Expands referenced resources. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetCloudServiceNetworkInterfaceWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (networkInterfaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("networkInterfaceName", networkInterfaceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCloudServiceNetworkInterface", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Deletes the specified network interface. /// @@ -2008,7 +2626,413 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkInterfaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("networkInterfaceName", networkInterfaceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a network interface. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the network interface. + /// + /// + /// Parameters supplied to the create or update network interface operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, NetworkInterface parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (networkInterfaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("networkInterfaceName", networkInterfaceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all route tables applied to a network interface. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the network interface. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginGetEffectiveRouteTableWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2034,11 +3058,11 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) tracingParameters.Add("networkInterfaceName", networkInterfaceName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginGetEffectiveRouteTable", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -2054,7 +3078,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2105,7 +3129,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2140,13 +3164,31 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -2155,7 +3197,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Creates or updates a network interface. + /// Gets all network security groups applied to a network interface. /// /// /// The name of the resource group. @@ -2163,9 +3205,6 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// The name of the network interface. /// - /// - /// Parameters supplied to the create or update network interface operation. - /// /// /// Headers that will be added to request. /// @@ -2187,7 +3226,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, NetworkInterface parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginListEffectiveNetworkSecurityGroupsWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -2197,14 +3236,6 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -2219,14 +3250,13 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("networkInterfaceName", networkInterfaceName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginListEffectiveNetworkSecurityGroups", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); @@ -2242,7 +3272,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2273,12 +3303,6 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -2299,7 +3323,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2334,7 +3358,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2347,25 +3371,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2385,13 +3391,10 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets all route tables applied to a network interface. + /// Gets all network interfaces in a subscription. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the network interface. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -2414,21 +3417,12 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginGetEffectiveRouteTableWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (networkInterfaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2020-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2436,23 +3430,14 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("networkInterfaceName", networkInterfaceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginGetEffectiveRouteTable", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveRouteTable").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -2460,7 +3445,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2511,7 +3496,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2546,7 +3531,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2559,7 +3544,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2579,13 +3564,10 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets all network security groups applied to a network interface. + /// Gets all network interfaces in a resource group. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the network interface. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -2608,21 +3590,12 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginListEffectiveNetworkSecurityGroupsWithHttpMessagesAsync(string resourceGroupName, string networkInterfaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (networkInterfaceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2020-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2630,23 +3603,14 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("networkInterfaceName", networkInterfaceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginListEffectiveNetworkSecurityGroups", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/effectiveNetworkSecurityGroups").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -2654,7 +3618,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2705,7 +3669,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2740,7 +3704,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2753,7 +3717,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2773,7 +3737,8 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets all network interfaces in a subscription. + /// Gets information about all network interfaces in a virtual machine in a + /// virtual machine scale set. /// /// /// The NextLink from the previous successful call to List operation. @@ -2799,7 +3764,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualMachineScaleSetVMNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2814,7 +3779,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetVMNetworkInterfacesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2946,7 +3911,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets all network interfaces in a resource group. + /// Gets all network interfaces in a virtual machine scale set. /// /// /// The NextLink from the previous successful call to List operation. @@ -2972,7 +3937,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualMachineScaleSetNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2987,7 +3952,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetNetworkInterfacesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3119,8 +4084,8 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets information about all network interfaces in a virtual machine in a - /// virtual machine scale set. + /// Get the specified network interface ip configuration in a virtual machine + /// scale set. /// /// /// The NextLink from the previous successful call to List operation. @@ -3146,7 +4111,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVirtualMachineScaleSetVMNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualMachineScaleSetIpConfigurationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3161,7 +4126,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetVMNetworkInterfacesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetIpConfigurationsNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3260,7 +4225,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3273,7 +4238,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -3293,7 +4258,8 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Gets all network interfaces in a virtual machine scale set. + /// Gets information about all network interfaces in a role instance in a cloud + /// service /// /// /// The NextLink from the previous successful call to List operation. @@ -3319,7 +4285,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVirtualMachineScaleSetNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCloudServiceRoleInstanceNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3334,7 +4300,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetNetworkInterfacesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceRoleInstanceNetworkInterfacesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3466,8 +4432,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) } /// - /// Get the specified network interface ip configuration in a virtual machine - /// scale set. + /// Gets all network interfaces in a cloud service. /// /// /// The NextLink from the previous successful call to List operation. @@ -3493,7 +4458,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVirtualMachineScaleSetIpConfigurationsNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCloudServiceNetworkInterfacesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -3508,7 +4473,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetIpConfigurationsNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceNetworkInterfacesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -3607,7 +4572,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -3620,7 +4585,7 @@ internal NetworkInterfacesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperationsExtensions.cs index 147ea53da6372..2a9b3bbeeee98 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkInterfacesOperationsExtensions.cs @@ -610,6 +610,152 @@ public static IPage ListVirtualMachineScaleSetNetworkInterface } } + /// + /// Gets information about all network interfaces in a role instance in a cloud + /// service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance. + /// + public static IPage ListCloudServiceRoleInstanceNetworkInterfaces(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName) + { + return operations.ListCloudServiceRoleInstanceNetworkInterfacesAsync(resourceGroupName, cloudServiceName, roleInstanceName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all network interfaces in a role instance in a cloud + /// service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceRoleInstanceNetworkInterfacesAsync(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceRoleInstanceNetworkInterfacesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstanceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + public static IPage ListCloudServiceNetworkInterfaces(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListCloudServiceNetworkInterfacesAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceNetworkInterfacesAsync(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceNetworkInterfacesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified network interface in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The name of the network interface. + /// + /// + /// Expands referenced resources. + /// + public static NetworkInterface GetCloudServiceNetworkInterface(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string expand = default(string)) + { + return operations.GetCloudServiceNetworkInterfaceAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, expand).GetAwaiter().GetResult(); + } + + /// + /// Get the specified network interface in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The name of the network interface. + /// + /// + /// Expands referenced resources. + /// + /// + /// The cancellation token. + /// + public static async Task GetCloudServiceNetworkInterfaceAsync(this INetworkInterfacesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCloudServiceNetworkInterfaceWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Deletes the specified network interface. /// @@ -947,5 +1093,75 @@ public static IPage ListVirtualMachineScaleSetI } } + /// + /// Gets information about all network interfaces in a role instance in a cloud + /// service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListCloudServiceRoleInstanceNetworkInterfacesNext(this INetworkInterfacesOperations operations, string nextPageLink) + { + return operations.ListCloudServiceRoleInstanceNetworkInterfacesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all network interfaces in a role instance in a cloud + /// service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceRoleInstanceNetworkInterfacesNextAsync(this INetworkInterfacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceRoleInstanceNetworkInterfacesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListCloudServiceNetworkInterfacesNext(this INetworkInterfacesOperations operations, string nextPageLink) + { + return operations.ListCloudServiceNetworkInterfacesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all network interfaces in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceNetworkInterfacesNextAsync(this INetworkInterfacesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceNetworkInterfacesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs index fbed9f40444cb..7a2d79eb50521 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs @@ -1523,14 +1523,1068 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) return _result; } + /// + /// Gets information about all public IP addresses on a cloud service level. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListCloudServicePublicIPAddressesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServicePublicIPAddresses", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/publicipaddresses").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The network interface name. + /// + /// + /// The IP configuration name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListCloudServiceRoleInstancePublicIPAddressesWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (networkInterfaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); + } + if (ipConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipConfigurationName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("networkInterfaceName", networkInterfaceName); + tracingParameters.Add("ipConfigurationName", ipConfigurationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceRoleInstancePublicIPAddresses", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); + _url = _url.Replace("{ipConfigurationName}", System.Uri.EscapeDataString(ipConfigurationName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified public IP address in a cloud service. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The role instance name. + /// + /// + /// The name of the network interface. + /// + /// + /// The name of the IP configuration. + /// + /// + /// The name of the public IP Address. + /// + /// + /// Expands referenced resources. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetCloudServicePublicIPAddressWithHttpMessagesAsync(string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, string publicIpAddressName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (cloudServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "cloudServiceName"); + } + if (roleInstanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "roleInstanceName"); + } + if (networkInterfaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "networkInterfaceName"); + } + if (ipConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ipConfigurationName"); + } + if (publicIpAddressName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicIpAddressName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cloudServiceName", cloudServiceName); + tracingParameters.Add("roleInstanceName", roleInstanceName); + tracingParameters.Add("networkInterfaceName", networkInterfaceName); + tracingParameters.Add("ipConfigurationName", ipConfigurationName); + tracingParameters.Add("publicIpAddressName", publicIpAddressName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCloudServicePublicIPAddress", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/cloudServices/{cloudServiceName}/roleInstances/{roleInstanceName}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{cloudServiceName}", System.Uri.EscapeDataString(cloudServiceName)); + _url = _url.Replace("{roleInstanceName}", System.Uri.EscapeDataString(roleInstanceName)); + _url = _url.Replace("{networkInterfaceName}", System.Uri.EscapeDataString(networkInterfaceName)); + _url = _url.Replace("{ipConfigurationName}", System.Uri.EscapeDataString(ipConfigurationName)); + _url = _url.Replace("{publicIpAddressName}", System.Uri.EscapeDataString(publicIpAddressName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Deletes the specified public IP address. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the public IP address. + /// + /// The name of the resource group. + /// + /// + /// The name of the public IP address. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string publicIpAddressName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (publicIpAddressName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicIpAddressName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("publicIpAddressName", publicIpAddressName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{publicIpAddressName}", System.Uri.EscapeDataString(publicIpAddressName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Creates or updates a static or dynamic public IP address. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the public IP address. + /// + /// + /// Parameters supplied to the create or update public IP address operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string publicIpAddressName, PublicIPAddress parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (publicIpAddressName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "publicIpAddressName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2020-07-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("publicIpAddressName", publicIpAddressName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{publicIpAddressName}", System.Uri.EscapeDataString(publicIpAddressName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the public IP addresses in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1541,6 +2595,9 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1550,21 +2607,12 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string publicIpAddressName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (publicIpAddressName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "publicIpAddressName"); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2020-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1572,23 +2620,14 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("publicIpAddressName", publicIpAddressName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{publicIpAddressName}", System.Uri.EscapeDataString(publicIpAddressName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1596,7 +2635,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1647,7 +2686,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1682,13 +2721,31 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1697,16 +2754,10 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) } /// - /// Creates or updates a static or dynamic public IP address. + /// Gets all public IP addresses in a resource group. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the public IP address. - /// - /// - /// Parameters supplied to the create or update public IP address operation. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1729,29 +2780,12 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string publicIpAddressName, PublicIPAddress parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (publicIpAddressName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "publicIpAddressName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2020-07-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1759,24 +2793,14 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("publicIpAddressName", publicIpAddressName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{publicIpAddressName}", System.Uri.EscapeDataString(publicIpAddressName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1784,7 +2808,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1815,12 +2839,6 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -1841,7 +2859,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1876,7 +2894,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1889,25 +2907,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1927,7 +2927,8 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) } /// - /// Gets all the public IP addresses in a subscription. + /// Gets information about all public IP addresses on a virtual machine scale + /// set level. /// /// /// The NextLink from the previous successful call to List operation. @@ -1953,7 +2954,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualMachineScaleSetPublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1968,7 +2969,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetPublicIPAddressesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2100,7 +3101,8 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) } /// - /// Gets all public IP addresses in a resource group. + /// Gets information about all public IP addresses in a virtual machine IP + /// configuration in a virtual machine scale set. /// /// /// The NextLink from the previous successful call to List operation. @@ -2126,7 +3128,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListVirtualMachineScaleSetVMPublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2141,7 +3143,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetVMPublicIPAddressesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2273,8 +3275,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) } /// - /// Gets information about all public IP addresses on a virtual machine scale - /// set level. + /// Gets information about all public IP addresses on a cloud service level. /// /// /// The NextLink from the previous successful call to List operation. @@ -2300,7 +3301,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVirtualMachineScaleSetPublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCloudServicePublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2315,7 +3316,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetPublicIPAddressesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServicePublicIPAddressesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; @@ -2447,8 +3448,8 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) } /// - /// Gets information about all public IP addresses in a virtual machine IP - /// configuration in a virtual machine scale set. + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. /// /// /// The NextLink from the previous successful call to List operation. @@ -2474,7 +3475,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListVirtualMachineScaleSetVMPublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListCloudServiceRoleInstancePublicIPAddressesNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -2489,7 +3490,7 @@ internal PublicIPAddressesOperations(NetworkManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListVirtualMachineScaleSetVMPublicIPAddressesNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListCloudServiceRoleInstancePublicIPAddressesNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs index 97b23fe331d7e..5c876d8a33cd6 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs @@ -430,6 +430,176 @@ public static IPage ListVirtualMachineScaleSetVMPublicIPAddress } } + /// + /// Gets information about all public IP addresses on a cloud service level. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + public static IPage ListCloudServicePublicIPAddresses(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName) + { + return operations.ListCloudServicePublicIPAddressesAsync(resourceGroupName, cloudServiceName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all public IP addresses on a cloud service level. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServicePublicIPAddressesAsync(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServicePublicIPAddressesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The network interface name. + /// + /// + /// The IP configuration name. + /// + public static IPage ListCloudServiceRoleInstancePublicIPAddresses(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName) + { + return operations.ListCloudServiceRoleInstancePublicIPAddressesAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The name of role instance + /// + /// + /// The network interface name. + /// + /// + /// The IP configuration name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceRoleInstancePublicIPAddressesAsync(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceRoleInstancePublicIPAddressesWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified public IP address in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The role instance name. + /// + /// + /// The name of the network interface. + /// + /// + /// The name of the IP configuration. + /// + /// + /// The name of the public IP Address. + /// + /// + /// Expands referenced resources. + /// + public static PublicIPAddress GetCloudServicePublicIPAddress(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, string publicIpAddressName, string expand = default(string)) + { + return operations.GetCloudServicePublicIPAddressAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, publicIpAddressName, expand).GetAwaiter().GetResult(); + } + + /// + /// Get the specified public IP address in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the cloud service. + /// + /// + /// The role instance name. + /// + /// + /// The name of the network interface. + /// + /// + /// The name of the IP configuration. + /// + /// + /// The name of the public IP Address. + /// + /// + /// Expands referenced resources. + /// + /// + /// The cancellation token. + /// + public static async Task GetCloudServicePublicIPAddressAsync(this IPublicIPAddressesOperations operations, string resourceGroupName, string cloudServiceName, string roleInstanceName, string networkInterfaceName, string ipConfigurationName, string publicIpAddressName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetCloudServicePublicIPAddressWithHttpMessagesAsync(resourceGroupName, cloudServiceName, roleInstanceName, networkInterfaceName, ipConfigurationName, publicIpAddressName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Deletes the specified public IP address. /// @@ -653,5 +823,75 @@ public static IPage ListVirtualMachineScaleSetVMPublicIPAddress } } + /// + /// Gets information about all public IP addresses on a cloud service level. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListCloudServicePublicIPAddressesNext(this IPublicIPAddressesOperations operations, string nextPageLink) + { + return operations.ListCloudServicePublicIPAddressesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all public IP addresses on a cloud service level. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServicePublicIPAddressesNextAsync(this IPublicIPAddressesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServicePublicIPAddressesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListCloudServiceRoleInstancePublicIPAddressesNext(this IPublicIPAddressesOperations operations, string nextPageLink) + { + return operations.ListCloudServiceRoleInstancePublicIPAddressesNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets information about all public IP addresses in a role instance IP + /// configuration in a cloud service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListCloudServiceRoleInstancePublicIPAddressesNextAsync(this IPublicIPAddressesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCloudServiceRoleInstancePublicIPAddressesNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs index dc7b75b454efc..ea03b5a098694 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SdkInfo_NetworkManagementClient.cs @@ -20,7 +20,9 @@ public static IEnumerable> ApiInfo_NetworkManageme return new Tuple[] { new Tuple("Compute", "NetworkInterfaces", "2018-10-01"), + new Tuple("Compute", "NetworkInterfaces", "2020-07-01"), new Tuple("Compute", "PublicIPAddresses", "2018-10-01"), + new Tuple("Compute", "PublicIPAddresses", "2020-07-01"), new Tuple("Network", "ApplicationGatewayPrivateEndpointConnections", "2020-07-01"), new Tuple("Network", "ApplicationGatewayPrivateLinkResources", "2020-07-01"), new Tuple("Network", "ApplicationGateways", "2020-07-01"), @@ -138,16 +140,5 @@ public static IEnumerable> ApiInfo_NetworkManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/network/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Projects\\Generator\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "f89a6707f26d612eceb8402f073932e6c72eff85"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj b/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj index f3f90c3e01532..6584a45c08b12 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Microsoft.Azure.Management.Network.csproj @@ -10,7 +10,7 @@ Development of this library has shifted focus to the Azure Unified SDK. The future development will be focused on "Azure.ResourceManager.Network" (https://www.nuget.org/packages/Azure.ResourceManager.Network/). Please see the package changelog for more information. Microsoft.Azure.Management.Network - 20.2.0 + 20.2.1 Microsoft Azure Network management;Network;Network management;