diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INatRulesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INatRulesOperations.cs index 2004e8e31428..5dd75cc0558b 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INatRulesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INatRulesOperations.cs @@ -23,6 +23,31 @@ namespace Microsoft.Azure.Management.Network /// public partial interface INatRulesOperations { + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The resource group name of the virtual network gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// 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>> ListByVirtualNetworkGatewayWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieves the details of a nat ruleGet. /// @@ -191,6 +216,28 @@ public partial interface INatRulesOperations /// Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string gatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// 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>> ListByVirtualNetworkGatewayNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Retrieves all nat rules for a particular virtual wan vpn gateway. /// /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs index 0b3ce8ad3813..9b1a29e49a7b 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs @@ -480,6 +480,16 @@ public partial interface INetworkManagementClient : System.IDisposable /// ILocalNetworkGatewaysOperations LocalNetworkGateways { get; } + /// + /// Gets the IVirtualNetworkGatewayNatRulesOperations. + /// + IVirtualNetworkGatewayNatRulesOperations VirtualNetworkGatewayNatRules { get; } + + /// + /// Gets the INatRulesOperations. + /// + INatRulesOperations NatRules { get; } + /// /// Gets the IVirtualNetworkTapsOperations. /// @@ -550,11 +560,6 @@ public partial interface INetworkManagementClient : System.IDisposable /// IVpnSiteLinkConnectionsOperations VpnSiteLinkConnections { get; } - /// - /// Gets the INatRulesOperations. - /// - INatRulesOperations NatRules { get; } - /// /// Gets the IP2sVpnGatewaysOperations. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IPublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualNetworkGatewayNatRulesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualNetworkGatewayNatRulesOperations.cs new file mode 100644 index 000000000000..194998d70055 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualNetworkGatewayNatRulesOperations.cs @@ -0,0 +1,169 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualNetworkGatewayNatRulesOperations operations. + /// + public partial interface IVirtualNetworkGatewayNatRulesOperations + { + /// + /// Retrieves the details of a nat ruleGet. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a nat rule to a scalable virtual network gateway if it + /// doesn't exist else updates the existing nat rules. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a nat rule. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The 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 + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a nat rule to a scalable virtual network gateway if it + /// doesn't exist else updates the existing nat rules. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a nat rule. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The 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 + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/IVirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FrontendIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IpAllocationMethod.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/IPAllocationMethod.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddress.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddress.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIpAddressDnsSettings.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPAddressDnsSettings.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ServiceEndpointPolicy.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ServiceEndpointPolicy.cs index feac83c23138..3798ebe8dbc2 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ServiceEndpointPolicy.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ServiceEndpointPolicy.cs @@ -51,7 +51,9 @@ public ServiceEndpointPolicy() /// 'Succeeded', 'Updating', 'Deleting', 'Failed' /// A unique read-only string that changes whenever /// the resource is updated. - public ServiceEndpointPolicy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList serviceEndpointPolicyDefinitions = default(IList), IList subnets = default(IList), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string)) + /// Kind of service endpoint policy. This is + /// metadata used for the Azure portal experience. + public ServiceEndpointPolicy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList serviceEndpointPolicyDefinitions = default(IList), IList subnets = default(IList), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string), string kind = default(string)) : base(id, name, type, location, tags) { ServiceEndpointPolicyDefinitions = serviceEndpointPolicyDefinitions; @@ -59,6 +61,7 @@ public ServiceEndpointPolicy() ResourceGuid = resourceGuid; ProvisioningState = provisioningState; Etag = etag; + Kind = kind; CustomInit(); } @@ -102,5 +105,12 @@ public ServiceEndpointPolicy() [JsonProperty(PropertyName = "etag")] public string Etag { get; private set; } + /// + /// Gets kind of service endpoint policy. This is metadata used for the + /// Azure portal experience. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGateway.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGateway.cs index 9b2a6633f0a5..cc03068e7b78 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGateway.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGateway.cs @@ -84,9 +84,14 @@ public VirtualNetworkGateway() /// associated with the customer vnet. /// The extended location /// of type local virtual network gateway. + /// NatRules for virtual network + /// gateway. + /// EnableBgpRouteTranslationForNat + /// flag. /// A unique read-only string that changes whenever /// the resource is updated. - public VirtualNetworkGateway(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList ipConfigurations = default(IList), string gatewayType = default(string), string vpnType = default(string), string vpnGatewayGeneration = default(string), bool? enableBgp = default(bool?), bool? enablePrivateIpAddress = default(bool?), bool? activeActive = default(bool?), SubResource gatewayDefaultSite = default(SubResource), VirtualNetworkGatewaySku sku = default(VirtualNetworkGatewaySku), VpnClientConfiguration vpnClientConfiguration = default(VpnClientConfiguration), BgpSettings bgpSettings = default(BgpSettings), AddressSpace customRoutes = default(AddressSpace), string resourceGuid = default(string), string provisioningState = default(string), bool? enableDnsForwarding = default(bool?), string inboundDnsForwardingEndpoint = default(string), string vNetExtendedLocationResourceId = default(string), ExtendedLocation virtualNetworkExtendedLocation = default(ExtendedLocation), string etag = default(string)) + public VirtualNetworkGateway(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList ipConfigurations = default(IList), string gatewayType = default(string), string vpnType = default(string), string vpnGatewayGeneration = default(string), bool? enableBgp = default(bool?), bool? enablePrivateIpAddress = default(bool?), bool? activeActive = default(bool?), SubResource gatewayDefaultSite = default(SubResource), VirtualNetworkGatewaySku sku = default(VirtualNetworkGatewaySku), VpnClientConfiguration vpnClientConfiguration = default(VpnClientConfiguration), BgpSettings bgpSettings = default(BgpSettings), AddressSpace customRoutes = default(AddressSpace), string resourceGuid = default(string), string provisioningState = default(string), bool? enableDnsForwarding = default(bool?), string inboundDnsForwardingEndpoint = default(string), string vNetExtendedLocationResourceId = default(string), ExtendedLocation virtualNetworkExtendedLocation = default(ExtendedLocation), IList natRules = default(IList), bool? enableBgpRouteTranslationForNat = default(bool?), string etag = default(string)) : base(id, name, type, location, tags) { IpConfigurations = ipConfigurations; @@ -107,6 +112,8 @@ public VirtualNetworkGateway() InboundDnsForwardingEndpoint = inboundDnsForwardingEndpoint; VNetExtendedLocationResourceId = vNetExtendedLocationResourceId; VirtualNetworkExtendedLocation = virtualNetworkExtendedLocation; + NatRules = natRules; + EnableBgpRouteTranslationForNat = enableBgpRouteTranslationForNat; Etag = etag; CustomInit(); } @@ -243,6 +250,18 @@ public VirtualNetworkGateway() [JsonProperty(PropertyName = "properties.virtualNetworkExtendedLocation")] public ExtendedLocation VirtualNetworkExtendedLocation { get; set; } + /// + /// Gets or sets natRules for virtual network gateway. + /// + [JsonProperty(PropertyName = "properties.natRules")] + public IList NatRules { get; set; } + + /// + /// Gets or sets enableBgpRouteTranslationForNat flag. + /// + [JsonProperty(PropertyName = "properties.enableBgpRouteTranslationForNat")] + public bool? EnableBgpRouteTranslationForNat { get; set; } + /// /// Gets a unique read-only string that changes whenever the resource /// is updated. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayConnection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayConnection.cs index 099f51438b2d..2a8bd9ae9131 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayConnection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayConnection.cs @@ -52,6 +52,8 @@ public VirtualNetworkGatewayConnection() /// network gateway resource. /// The reference to local network /// gateway resource. + /// List of ingress NatRules. + /// List of egress NatRules. /// Connection protocol used for this /// connection. Possible values include: 'IKEv2', 'IKEv1' /// The routing weight. @@ -89,13 +91,15 @@ public VirtualNetworkGatewayConnection() /// for data forwarding. /// A unique read-only string that changes whenever /// the resource is updated. - public VirtualNetworkGatewayConnection(VirtualNetworkGateway virtualNetworkGateway1, string connectionType, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string authorizationKey = default(string), VirtualNetworkGateway virtualNetworkGateway2 = default(VirtualNetworkGateway), LocalNetworkGateway localNetworkGateway2 = default(LocalNetworkGateway), string connectionProtocol = default(string), int? routingWeight = default(int?), int? dpdTimeoutSeconds = default(int?), string connectionMode = default(string), string sharedKey = default(string), string connectionStatus = default(string), IList tunnelConnectionStatus = default(IList), long? egressBytesTransferred = default(long?), long? ingressBytesTransferred = default(long?), SubResource peer = default(SubResource), bool? enableBgp = default(bool?), bool? useLocalAzureIpAddress = default(bool?), bool? usePolicyBasedTrafficSelectors = default(bool?), IList ipsecPolicies = default(IList), IList trafficSelectorPolicies = default(IList), string resourceGuid = default(string), string provisioningState = default(string), bool? expressRouteGatewayBypass = default(bool?), string etag = default(string)) + public VirtualNetworkGatewayConnection(VirtualNetworkGateway virtualNetworkGateway1, string connectionType, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string authorizationKey = default(string), VirtualNetworkGateway virtualNetworkGateway2 = default(VirtualNetworkGateway), LocalNetworkGateway localNetworkGateway2 = default(LocalNetworkGateway), IList ingressNatRules = default(IList), IList egressNatRules = default(IList), string connectionProtocol = default(string), int? routingWeight = default(int?), int? dpdTimeoutSeconds = default(int?), string connectionMode = default(string), string sharedKey = default(string), string connectionStatus = default(string), IList tunnelConnectionStatus = default(IList), long? egressBytesTransferred = default(long?), long? ingressBytesTransferred = default(long?), SubResource peer = default(SubResource), bool? enableBgp = default(bool?), bool? useLocalAzureIpAddress = default(bool?), bool? usePolicyBasedTrafficSelectors = default(bool?), IList ipsecPolicies = default(IList), IList trafficSelectorPolicies = default(IList), string resourceGuid = default(string), string provisioningState = default(string), bool? expressRouteGatewayBypass = default(bool?), string etag = default(string)) : base(id, name, type, location, tags) { AuthorizationKey = authorizationKey; VirtualNetworkGateway1 = virtualNetworkGateway1; VirtualNetworkGateway2 = virtualNetworkGateway2; LocalNetworkGateway2 = localNetworkGateway2; + IngressNatRules = ingressNatRules; + EgressNatRules = egressNatRules; ConnectionType = connectionType; ConnectionProtocol = connectionProtocol; RoutingWeight = routingWeight; @@ -148,6 +152,18 @@ public VirtualNetworkGatewayConnection() [JsonProperty(PropertyName = "properties.localNetworkGateway2")] public LocalNetworkGateway LocalNetworkGateway2 { get; set; } + /// + /// Gets or sets list of ingress NatRules. + /// + [JsonProperty(PropertyName = "properties.ingressNatRules")] + public IList IngressNatRules { get; set; } + + /// + /// Gets or sets list of egress NatRules. + /// + [JsonProperty(PropertyName = "properties.egressNatRules")] + public IList EgressNatRules { get; set; } + /// /// Gets or sets gateway connection type. Possible values include: /// 'IPsec', 'Vnet2Vnet', 'ExpressRoute', 'VPNClient' diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIpConfiguration.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayNatRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayNatRule.cs new file mode 100644 index 000000000000..f869335babac --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/VirtualNetworkGatewayNatRule.cs @@ -0,0 +1,140 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// VirtualNetworkGatewayNatRule Resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class VirtualNetworkGatewayNatRule : SubResource + { + /// + /// Initializes a new instance of the VirtualNetworkGatewayNatRule + /// class. + /// + public VirtualNetworkGatewayNatRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the VirtualNetworkGatewayNatRule + /// class. + /// + /// Resource ID. + /// The provisioning state of the NAT + /// Rule resource. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// The type + /// of NAT rule for VPN NAT. Possible values include: 'Static', + /// 'Dynamic' + /// The Source NAT direction of a VPN NAT. Possible + /// values include: 'EgressSnat', 'IngressSnat' + /// The private IP address internal + /// mapping for NAT. + /// The private IP address external + /// mapping for NAT. + /// The IP Configuration ID this NAT + /// rule applies to. + /// The name of the resource that is unique within a + /// resource group. This name can be used to access the + /// resource. + /// A unique read-only string that changes whenever + /// the resource is updated. + /// Resource type. + public VirtualNetworkGatewayNatRule(string id = default(string), string provisioningState = default(string), string virtualNetworkGatewayNatRulePropertiesType = default(string), string mode = default(string), IList internalMappings = default(IList), IList externalMappings = default(IList), string ipConfigurationId = default(string), string name = default(string), string etag = default(string), string type = default(string)) + : base(id) + { + ProvisioningState = provisioningState; + VirtualNetworkGatewayNatRulePropertiesType = virtualNetworkGatewayNatRulePropertiesType; + Mode = mode; + InternalMappings = internalMappings; + ExternalMappings = externalMappings; + IpConfigurationId = ipConfigurationId; + Name = name; + Etag = etag; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the provisioning state of the NAT Rule resource. Possible + /// values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the type of NAT rule for VPN NAT. Possible values + /// include: 'Static', 'Dynamic' + /// + [JsonProperty(PropertyName = "properties.type")] + public string VirtualNetworkGatewayNatRulePropertiesType { get; set; } + + /// + /// Gets or sets the Source NAT direction of a VPN NAT. Possible values + /// include: 'EgressSnat', 'IngressSnat' + /// + [JsonProperty(PropertyName = "properties.mode")] + public string Mode { get; set; } + + /// + /// Gets or sets the private IP address internal mapping for NAT. + /// + [JsonProperty(PropertyName = "properties.internalMappings")] + public IList InternalMappings { get; set; } + + /// + /// Gets or sets the private IP address external mapping for NAT. + /// + [JsonProperty(PropertyName = "properties.externalMappings")] + public IList ExternalMappings { get; set; } + + /// + /// Gets or sets the IP Configuration ID this NAT rule applies to. + /// + [JsonProperty(PropertyName = "properties.ipConfigurationId")] + public string IpConfigurationId { get; set; } + + /// + /// Gets or sets the name of the resource that is unique within a + /// resource group. This name can be used to access the resource. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperations.cs index f9ca5ba58ff9..c5a8c1fda1b9 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperations.cs @@ -50,6 +50,200 @@ internal NatRulesOperations(NetworkManagementClient client) /// public NetworkManagementClient Client { get; private set; } + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The resource group name of the virtual network gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// 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>> ListByVirtualNetworkGatewayWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualNetworkGatewayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkGatewayName"); + } + string apiVersion = "2020-11-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("virtualNetworkGatewayName", virtualNetworkGatewayName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVirtualNetworkGateway", 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/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualNetworkGatewayName}", System.Uri.EscapeDataString(virtualNetworkGatewayName)); + 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; + } + /// /// Retrieves the details of a nat ruleGet. /// @@ -919,6 +1113,179 @@ internal NatRulesOperations(NetworkManagementClient client) return _result; } + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The NextLink from the previous successful call to List 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>> ListByVirtualNetworkGatewayNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByVirtualNetworkGatewayNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + 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; + } + /// /// Retrieves all nat rules for a particular virtual wan vpn gateway. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperationsExtensions.cs index b5043f5ddffc..65ee046637f8 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NatRulesOperationsExtensions.cs @@ -21,6 +21,46 @@ namespace Microsoft.Azure.Management.Network /// public static partial class NatRulesOperationsExtensions { + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the virtual network gateway. + /// + /// + /// The name of the gateway. + /// + public static IPage ListByVirtualNetworkGateway(this INatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName) + { + return operations.ListByVirtualNetworkGatewayAsync(resourceGroupName, virtualNetworkGatewayName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the virtual network gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByVirtualNetworkGatewayAsync(this INatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVirtualNetworkGatewayWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Retrieves the details of a nat ruleGet. /// @@ -301,6 +341,40 @@ public static void BeginDelete(this INatRulesOperations operations, string resou (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, gatewayName, natRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByVirtualNetworkGatewayNext(this INatRulesOperations operations, string nextPageLink) + { + return operations.ListByVirtualNetworkGatewayNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all nat rules for a particular virtual network gateway. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByVirtualNetworkGatewayNextAsync(this INatRulesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByVirtualNetworkGatewayNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Retrieves all nat rules for a particular virtual wan vpn gateway. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs index 92e7f089e856..22fa5a4dbc6f 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs @@ -483,6 +483,16 @@ public partial class NetworkManagementClient : ServiceClient public virtual ILocalNetworkGatewaysOperations LocalNetworkGateways { get; private set; } + /// + /// Gets the IVirtualNetworkGatewayNatRulesOperations. + /// + public virtual IVirtualNetworkGatewayNatRulesOperations VirtualNetworkGatewayNatRules { get; private set; } + + /// + /// Gets the INatRulesOperations. + /// + public virtual INatRulesOperations NatRules { get; private set; } + /// /// Gets the IVirtualNetworkTapsOperations. /// @@ -553,11 +563,6 @@ public partial class NetworkManagementClient : ServiceClient public virtual IVpnSiteLinkConnectionsOperations VpnSiteLinkConnections { get; private set; } - /// - /// Gets the INatRulesOperations. - /// - public virtual INatRulesOperations NatRules { get; private set; } - /// /// Gets the IP2sVpnGatewaysOperations. /// @@ -930,6 +935,8 @@ private void Initialize() VirtualNetworkGateways = new VirtualNetworkGatewaysOperations(this); VirtualNetworkGatewayConnections = new VirtualNetworkGatewayConnectionsOperations(this); LocalNetworkGateways = new LocalNetworkGatewaysOperations(this); + VirtualNetworkGatewayNatRules = new VirtualNetworkGatewayNatRulesOperations(this); + NatRules = new NatRulesOperations(this); VirtualNetworkTaps = new VirtualNetworkTapsOperations(this); VirtualRouters = new VirtualRoutersOperations(this); VirtualRouterPeerings = new VirtualRouterPeeringsOperations(this); @@ -944,7 +951,6 @@ private void Initialize() VpnLinkConnections = new VpnLinkConnectionsOperations(this); VpnConnections = new VpnConnectionsOperations(this); VpnSiteLinkConnections = new VpnSiteLinkConnectionsOperations(this); - NatRules = new NatRulesOperations(this); P2sVpnGateways = new P2sVpnGatewaysOperations(this); VpnServerConfigurationsAssociatedWithVirtualWan = new VpnServerConfigurationsAssociatedWithVirtualWanOperations(this); VirtualHubRouteTableV2s = new VirtualHubRouteTableV2sOperations(this); diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIpAddressesOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/PublicIPAddressesOperationsExtensions.cs 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 94a55d2806f6..eeeb833bd174 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 @@ -119,6 +119,7 @@ public static IEnumerable> ApiInfo_NetworkManageme new Tuple("Network", "VirtualHubRouteTableV2s", "2020-11-01"), new Tuple("Network", "VirtualHubs", "2020-11-01"), new Tuple("Network", "VirtualNetworkGatewayConnections", "2020-11-01"), + new Tuple("Network", "VirtualNetworkGatewayNatRules", "2020-11-01"), new Tuple("Network", "VirtualNetworkGateways", "2020-11-01"), new Tuple("Network", "VirtualNetworkPeerings", "2020-11-01"), new Tuple("Network", "VirtualNetworkTaps", "2020-11-01"), @@ -141,16 +142,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 = "bd75cbc7ae9c997f39362ac9d19d557219720bbd"; - 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/Generated/VirtualNetworkGatewayNatRulesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayNatRulesOperations.cs new file mode 100644 index 000000000000..e1042c3bd3ab --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayNatRulesOperations.cs @@ -0,0 +1,729 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// VirtualNetworkGatewayNatRulesOperations operations. + /// + internal partial class VirtualNetworkGatewayNatRulesOperations : IServiceOperations, IVirtualNetworkGatewayNatRulesOperations + { + /// + /// Initializes a new instance of the VirtualNetworkGatewayNatRulesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal VirtualNetworkGatewayNatRulesOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Retrieves the details of a nat ruleGet. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualNetworkGatewayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkGatewayName"); + } + if (natRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "natRuleName"); + } + string apiVersion = "2020-11-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("virtualNetworkGatewayName", virtualNetworkGatewayName); + tracingParameters.Add("natRuleName", natRuleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", 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/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualNetworkGatewayName}", System.Uri.EscapeDataString(virtualNetworkGatewayName)); + _url = _url.Replace("{natRuleName}", System.Uri.EscapeDataString(natRuleName)); + 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; + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a nat rule. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// 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 virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualNetworkGatewayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkGatewayName"); + } + if (natRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "natRuleName"); + } + if (natRuleParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "natRuleParameters"); + } + string apiVersion = "2020-11-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("virtualNetworkGatewayName", virtualNetworkGatewayName); + tracingParameters.Add("natRuleName", natRuleName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("natRuleParameters", natRuleParameters); + 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/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualNetworkGatewayName}", System.Uri.EscapeDataString(virtualNetworkGatewayName)); + _url = _url.Replace("{natRuleName}", System.Uri.EscapeDataString(natRuleName)); + 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(natRuleParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(natRuleParameters, 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; + } + + /// + /// Deletes a nat rule. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// 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 virtualNetworkGatewayName, string natRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualNetworkGatewayName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkGatewayName"); + } + if (natRuleName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "natRuleName"); + } + string apiVersion = "2020-11-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("virtualNetworkGatewayName", virtualNetworkGatewayName); + tracingParameters.Add("natRuleName", natRuleName); + 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/virtualNetworkGateways/{virtualNetworkGatewayName}/natRules/{natRuleName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualNetworkGatewayName}", System.Uri.EscapeDataString(virtualNetworkGatewayName)); + _url = _url.Replace("{natRuleName}", System.Uri.EscapeDataString(natRuleName)); + 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; + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayNatRulesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayNatRulesOperationsExtensions.cs new file mode 100644 index 000000000000..fa973de00a2f --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayNatRulesOperationsExtensions.cs @@ -0,0 +1,265 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for VirtualNetworkGatewayNatRulesOperations. + /// + public static partial class VirtualNetworkGatewayNatRulesOperationsExtensions + { + /// + /// Retrieves the details of a nat ruleGet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + public static VirtualNetworkGatewayNatRule Get(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName) + { + return operations.GetAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the details of a nat ruleGet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + public static VirtualNetworkGatewayNatRule CreateOrUpdate(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a nat rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + public static void Delete(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName) + { + operations.DeleteAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a nat rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + public static VirtualNetworkGatewayNatRule BeginCreateOrUpdate(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a nat rule to a scalable virtual network gateway if it doesn't + /// exist else updates the existing nat rules. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// Parameters supplied to create or Update a Nat Rule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, VirtualNetworkGatewayNatRule natRuleParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, natRuleParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a nat rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + public static void BeginDelete(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName) + { + operations.BeginDeleteAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a nat rule. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Virtual Network Gateway. + /// + /// + /// The name of the gateway. + /// + /// + /// The name of the nat rule. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IVirtualNetworkGatewayNatRulesOperations operations, string resourceGroupName, string virtualNetworkGatewayName, string natRuleName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, virtualNetworkGatewayName, natRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperations.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperations.cs diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs similarity index 100% rename from sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWANsOperationsExtensions.cs rename to sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualWansOperationsExtensions.cs