From 130004931ab531cde01ac80c6fa75e6977de45b6 Mon Sep 17 00:00:00 2001 From: "openapi-bot[bot]" <37845953+openapi-bot[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2019 01:15:06 +0000 Subject: [PATCH] Generated from ec578e180c4515be63046f0b0991d7b9547e657d (#58) Update description of "location" in serviceTags.json --- .../Generated/FirewallPoliciesOperations.cs | 1612 +++++++++++++++++ .../FirewallPoliciesOperationsExtensions.cs | 413 +++++ .../FirewallPolicyRuleGroupsOperations.cs | 1100 +++++++++++ ...allPolicyRuleGroupsOperationsExtensions.cs | 339 ++++ .../Generated/IFirewallPoliciesOperations.cs | 270 +++ .../IFirewallPolicyRuleGroupsOperations.cs | 216 +++ .../src/Generated/INetworkManagementClient.cs | 10 + ...ons.cs => IPublicIPAddressesOperations.cs} | 0 .../src/Generated/IServiceTagsOperations.cs | 5 +- .../src/Generated/ISubnetsOperations.cs | 58 + ...perations.cs => IVirtualWansOperations.cs} | 0 ...licationGatewayFrontendIPConfiguration.cs} | 0 ...s => ApplicationGatewayIPConfiguration.cs} | 0 .../Models/ApplicationGatewayOnDemandProbe.cs | 28 +- .../Models/ApplicationRuleCondition.cs | 93 + .../src/Generated/Models/AzureFirewall.cs | 30 +- .../Models/AzureFirewallPublicIPAddress.cs | 53 + .../src/Generated/Models/FirewallPolicy.cs | 124 ++ .../Models/FirewallPolicyFilterRule.cs | 76 + .../Models/FirewallPolicyFilterRuleAction.cs | 55 + .../FirewallPolicyFilterRuleActionType.cs | 23 + .../Generated/Models/FirewallPolicyNatRule.cs | 93 + .../Models/FirewallPolicyNatRuleAction.cs | 55 + .../Models/FirewallPolicyNatRuleActionType.cs | 22 + .../Generated/Models/FirewallPolicyRule.cs | 78 + .../Models/FirewallPolicyRuleCondition.cs | 62 + ...lPolicyRuleConditionApplicationProtocol.cs | 83 + ...icyRuleConditionApplicationProtocolType.cs | 22 + ...ewallPolicyRuleConditionNetworkProtocol.cs | 24 + .../Models/FirewallPolicyRuleGroup.cs | 134 ++ ...guration.cs => FrontendIPConfiguration.cs} | 0 .../src/Generated/Models/HubIPAddresses.cs | 64 + ...ocationMethod.cs => IPAllocationMethod.cs} | 0 ....cs => NetworkInterfaceIPConfiguration.cs} | 0 .../Generated/Models/NetworkRuleCondition.cs | 84 + .../src/Generated/Models/PrivateEndpoint.cs | 19 +- .../Models/PrivateEndpointConnection.cs | 32 +- .../Generated/Models/PrivateLinkService.cs | 19 +- .../Models/PrivateLinkServiceConnection.cs | 32 +- .../PrivateLinkServiceIpConfiguration.cs | 47 +- ...{PublicIpAddress.cs => PublicIPAddress.cs} | 0 ...tings.cs => PublicIPAddressDnsSettings.cs} | 0 .../src/Generated/Models/PublicIPPrefix.cs | 13 +- .../Models/UnprepareNetworkPoliciesRequest.cs | 55 + ...> VirtualNetworkGatewayIPConfiguration.cs} | 0 .../src/Generated/NetworkManagementClient.cs | 16 + ...ions.cs => PublicIPAddressesOperations.cs} | 0 ... PublicIPAddressesOperationsExtensions.cs} | 0 .../SdkInfo_NetworkManagementClient.cs | 2 + .../src/Generated/ServiceTagsOperations.cs | 5 +- .../ServiceTagsOperationsExtensions.cs | 10 +- .../src/Generated/SubnetsOperations.cs | 224 +++ .../Generated/SubnetsOperationsExtensions.cs | 98 + ...tualNetworkGatewayConnectionsOperations.cs | 2 +- .../VirtualNetworkGatewaysOperations.cs | 2 +- ...Operations.cs => VirtualWansOperations.cs} | 0 ....cs => VirtualWansOperationsExtensions.cs} | 0 57 files changed, 5747 insertions(+), 55 deletions(-) create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperations.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperationsExtensions.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperations.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperationsExtensions.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPoliciesOperations.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPolicyRuleGroupsOperations.cs rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{IPublicIpAddressesOperations.cs => IPublicIPAddressesOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{IVirtualWANsOperations.cs => IVirtualWansOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{ApplicationGatewayFrontendIpConfiguration.cs => ApplicationGatewayFrontendIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{ApplicationGatewayIpConfiguration.cs => ApplicationGatewayIPConfiguration.cs} (100%) create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRuleCondition.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallPublicIPAddress.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicy.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRule.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleAction.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleActionType.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRule.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleAction.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleActionType.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCondition.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocol.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocolType.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionNetworkProtocol.cs create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleGroup.cs rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{FrontendIpConfiguration.cs => FrontendIPConfiguration.cs} (100%) create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HubIPAddresses.cs rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{IpAllocationMethod.cs => IPAllocationMethod.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{NetworkInterfaceIpConfiguration.cs => NetworkInterfaceIPConfiguration.cs} (100%) create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRuleCondition.cs rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{PublicIpAddress.cs => PublicIPAddress.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{PublicIpAddressDnsSettings.cs => PublicIPAddressDnsSettings.cs} (100%) create mode 100644 sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/UnprepareNetworkPoliciesRequest.cs rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/{VirtualNetworkGatewayIpConfiguration.cs => VirtualNetworkGatewayIPConfiguration.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{PublicIpAddressesOperations.cs => PublicIPAddressesOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{PublicIpAddressesOperationsExtensions.cs => PublicIPAddressesOperationsExtensions.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{VirtualWANsOperations.cs => VirtualWansOperations.cs} (100%) rename sdk/network/Microsoft.Azure.Management.Network/src/Generated/{VirtualWANsOperationsExtensions.cs => VirtualWansOperationsExtensions.cs} (100%) diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperations.cs new file mode 100644 index 0000000000000..6732b68eba41c --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperations.cs @@ -0,0 +1,1612 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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; + + /// + /// FirewallPoliciesOperations operations. + /// + internal partial class FirewallPoliciesOperations : IServiceOperations, IFirewallPoliciesOperations + { + /// + /// Initializes a new instance of the FirewallPoliciesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FirewallPoliciesOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("expand", expand); + 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/firewallPolicies/{firewallPolicyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _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; + } + + /// + /// Updates a Firewall Policy Tags. + /// + /// + /// The resource group name of the Firewall Policy. + /// + /// + /// The name of the Firewall Policy being updated. + /// + /// + /// Parameters supplied to Update Firewall Policy tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, TagsObject firewallPolicyParameters, 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 (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (firewallPolicyParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyParameters"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("firewallPolicyParameters", firewallPolicyParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", 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/firewallPolicies/{firewallPolicyName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + 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("PATCH"); + _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(firewallPolicyParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(firewallPolicyParameters, 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) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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 or updates the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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/firewallPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _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 the Firewall Policies in a subscription. + /// + /// + /// 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>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-01"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/firewallPolicies").ToString(); + _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; + } + + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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 firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + 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/firewallPolicies/{firewallPolicyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _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 the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy 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 firewallPolicyName, FirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + 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/firewallPolicies/{firewallPolicyName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _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; + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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; + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// 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>> ListAllNextWithHttpMessagesAsync(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, "ListAllNext", 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; + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperationsExtensions.cs new file mode 100644 index 0000000000000..4eb14bb3e4669 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPoliciesOperationsExtensions.cs @@ -0,0 +1,413 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 FirewallPoliciesOperations. + /// + public static partial class FirewallPoliciesOperationsExtensions + { + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + public static void Delete(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName) + { + operations.DeleteAsync(resourceGroupName, firewallPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Expands referenced resources. + /// + public static FirewallPolicy Get(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, string expand = default(string)) + { + return operations.GetAsync(resourceGroupName, firewallPolicyName, expand).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Expands referenced resources. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates a Firewall Policy Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Firewall Policy. + /// + /// + /// The name of the Firewall Policy being updated. + /// + /// + /// Parameters supplied to Update Firewall Policy tags. + /// + public static FirewallPolicy UpdateTags(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, TagsObject firewallPolicyParameters) + { + return operations.UpdateTagsAsync(resourceGroupName, firewallPolicyName, firewallPolicyParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates a Firewall Policy Tags. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name of the Firewall Policy. + /// + /// + /// The name of the Firewall Policy being updated. + /// + /// + /// Parameters supplied to Update Firewall Policy tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, TagsObject firewallPolicyParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, firewallPolicyParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy operation. + /// + public static FirewallPolicy CreateOrUpdate(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, firewallPolicyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + public static IPage List(this IFirewallPoliciesOperations operations, string resourceGroupName) + { + return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListAll(this IFirewallPoliciesOperations operations) + { + return operations.ListAllAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllAsync(this IFirewallPoliciesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + public static void BeginDelete(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName) + { + operations.BeginDeleteAsync(resourceGroupName, firewallPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy operation. + /// + public static FirewallPolicy BeginCreateOrUpdate(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, firewallPolicyName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFirewallPoliciesOperations operations, string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFirewallPoliciesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IFirewallPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListAllNext(this IFirewallPoliciesOperations operations, string nextPageLink) + { + return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAllNextAsync(this IFirewallPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperations.cs new file mode 100644 index 0000000000000..65d78434763b4 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperations.cs @@ -0,0 +1,1100 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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; + + /// + /// FirewallPolicyRuleGroupsOperations operations. + /// + internal partial class FirewallPolicyRuleGroupsOperations : IServiceOperations, IFirewallPolicyRuleGroupsOperations + { + /// + /// Initializes a new instance of the FirewallPolicyRuleGroupsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FirewallPolicyRuleGroupsOperations(NetworkManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the NetworkManagementClient + /// + public NetworkManagementClient Client { get; private set; } + + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// 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 firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (ruleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("ruleGroupName", ruleGroupName); + 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/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _url = _url.Replace("{ruleGroupName}", System.Uri.EscapeDataString(ruleGroupName)); + _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; + } + + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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/firewallPolicies/{firewallPolicyName}/ruleGroups").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _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; + } + + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// 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 firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (ruleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleGroupName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("ruleGroupName", ruleGroupName); + 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/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _url = _url.Replace("{ruleGroupName}", System.Uri.EscapeDataString(ruleGroupName)); + _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 the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// 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 firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (firewallPolicyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "firewallPolicyName"); + } + if (ruleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ruleGroupName"); + } + 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 = "2019-06-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("firewallPolicyName", firewallPolicyName); + tracingParameters.Add("ruleGroupName", ruleGroupName); + 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/firewallPolicies/{firewallPolicyName}/ruleGroups/{ruleGroupName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{firewallPolicyName}", System.Uri.EscapeDataString(firewallPolicyName)); + _url = _url.Replace("{ruleGroupName}", System.Uri.EscapeDataString(ruleGroupName)); + _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; + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(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, "ListNext", 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; + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperationsExtensions.cs new file mode 100644 index 0000000000000..9e8135c3fc9cf --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/FirewallPolicyRuleGroupsOperationsExtensions.cs @@ -0,0 +1,339 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 FirewallPolicyRuleGroupsOperations. + /// + public static partial class FirewallPolicyRuleGroupsOperationsExtensions + { + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + public static void Delete(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName) + { + operations.DeleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + public static FirewallPolicyRuleGroup Get(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName) + { + return operations.GetAsync(resourceGroupName, firewallPolicyName, ruleGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// operation. + /// + public static FirewallPolicyRuleGroup CreateOrUpdate(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + public static IPage List(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName) + { + return operations.ListAsync(resourceGroupName, firewallPolicyName).GetAwaiter().GetResult(); + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + public static void BeginDelete(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName) + { + operations.BeginDeleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// operation. + /// + public static FirewallPolicyRuleGroup BeginCreateOrUpdate(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// operation. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFirewallPolicyRuleGroupsOperations operations, string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFirewallPolicyRuleGroupsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IFirewallPolicyRuleGroupsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPoliciesOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPoliciesOperations.cs new file mode 100644 index 0000000000000..2306857015997 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPoliciesOperations.cs @@ -0,0 +1,270 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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; + + /// + /// FirewallPoliciesOperations operations. + /// + public partial interface IFirewallPoliciesOperations + { + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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 firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates a Firewall Policy Tags. + /// + /// + /// The resource group name of the Firewall Policy. + /// + /// + /// The name of the Firewall Policy being updated. + /// + /// + /// Parameters supplied to Update Firewall Policy tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, TagsObject firewallPolicyParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// The name of the resource group. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// 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>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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 firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified Firewall Policy. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// Parameters supplied to the create or update Firewall Policy + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, FirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all Firewall Policies in a resource group. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the Firewall Policies in a subscription. + /// + /// + /// 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>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPolicyRuleGroupsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPolicyRuleGroupsOperations.cs new file mode 100644 index 0000000000000..eae6710507b8d --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IFirewallPolicyRuleGroupsOperations.cs @@ -0,0 +1,216 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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; + + /// + /// FirewallPolicyRuleGroupsOperations operations. + /// + public partial interface IFirewallPolicyRuleGroupsOperations + { + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// 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 firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// 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 firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// 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 firewallPolicyName, string ruleGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates the specified FirewallPolicyRuleGroup. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the Firewall Policy. + /// + /// + /// The name of the FirewallPolicyRuleGroup. + /// + /// + /// Parameters supplied to the create or update FirewallPolicyRuleGroup + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string firewallPolicyName, string ruleGroupName, FirewallPolicyRuleGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource. + /// + /// + /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} 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 db4a4794f2138..5a9737ba4790f 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/INetworkManagementClient.cs @@ -190,6 +190,16 @@ public partial interface INetworkManagementClient : System.IDisposable /// IExpressRouteLinksOperations ExpressRouteLinks { get; } + /// + /// Gets the IFirewallPoliciesOperations. + /// + IFirewallPoliciesOperations FirewallPolicies { get; } + + /// + /// Gets the IFirewallPolicyRuleGroupsOperations. + /// + IFirewallPolicyRuleGroupsOperations FirewallPolicyRuleGroups { get; } + /// /// Gets the ILoadBalancersOperations. /// 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/IServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs index 7aa52a33381d9..d6e0a0b50a274 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/IServiceTagsOperations.cs @@ -27,7 +27,10 @@ public partial interface IServiceTagsOperations /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a + /// filter based on location, you will get the list of service tags + /// with prefix details across all regions but limited to the cloud + /// that your subscription belongs to). /// /// /// The headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ISubnetsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ISubnetsOperations.cs index 812f6515d9fe4..b4d48b1613ffe 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ISubnetsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ISubnetsOperations.cs @@ -140,6 +140,35 @@ public partial interface ISubnetsOperations /// Task PrepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent + /// policies. + /// + /// + /// 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 UnprepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all subnets in a virtual network. /// /// @@ -250,6 +279,35 @@ public partial interface ISubnetsOperations /// Task BeginPrepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, PrepareNetworkPoliciesRequest prepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent + /// policies. + /// + /// + /// 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 BeginUnprepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Gets all subnets in a virtual network. /// /// 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/ApplicationGatewayOnDemandProbe.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs index 1eea633bdd50e..5f4d8b39212e0 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs @@ -45,11 +45,11 @@ public ApplicationGatewayOnDemandProbe() /// value is false. /// Criterion for classifying a healthy probe /// response. - /// Name of backend pool of application - /// gateway to which probe request will be sent. - /// Name of backend http setting + /// Reference of backend pool of + /// application gateway to which probe request will be sent. + /// Reference of backend http setting /// of application gateway to be used for test probe. - public ApplicationGatewayOnDemandProbe(string protocol = default(string), string host = default(string), string path = default(string), int? timeout = default(int?), bool? pickHostNameFromBackendHttpSettings = default(bool?), ApplicationGatewayProbeHealthResponseMatch match = default(ApplicationGatewayProbeHealthResponseMatch), string backendPoolName = default(string), string backendHttpSettingName = default(string)) + public ApplicationGatewayOnDemandProbe(string protocol = default(string), string host = default(string), string path = default(string), int? timeout = default(int?), bool? pickHostNameFromBackendHttpSettings = default(bool?), ApplicationGatewayProbeHealthResponseMatch match = default(ApplicationGatewayProbeHealthResponseMatch), SubResource backendAddressPool = default(SubResource), SubResource backendHttpSettings = default(SubResource)) { Protocol = protocol; Host = host; @@ -57,8 +57,8 @@ public ApplicationGatewayOnDemandProbe() Timeout = timeout; PickHostNameFromBackendHttpSettings = pickHostNameFromBackendHttpSettings; Match = match; - BackendPoolName = backendPoolName; - BackendHttpSettingName = backendHttpSettingName; + BackendAddressPool = backendAddressPool; + BackendHttpSettings = backendHttpSettings; CustomInit(); } @@ -110,18 +110,18 @@ public ApplicationGatewayOnDemandProbe() public ApplicationGatewayProbeHealthResponseMatch Match { get; set; } /// - /// Gets or sets name of backend pool of application gateway to which - /// probe request will be sent. + /// Gets or sets reference of backend pool of application gateway to + /// which probe request will be sent. /// - [JsonProperty(PropertyName = "backendPoolName")] - public string BackendPoolName { get; set; } + [JsonProperty(PropertyName = "backendAddressPool")] + public SubResource BackendAddressPool { get; set; } /// - /// Gets or sets name of backend http setting of application gateway to - /// be used for test probe. + /// Gets or sets reference of backend http setting of application + /// gateway to be used for test probe. /// - [JsonProperty(PropertyName = "backendHttpSettingName")] - public string BackendHttpSettingName { get; set; } + [JsonProperty(PropertyName = "backendHttpSettings")] + public SubResource BackendHttpSettings { get; set; } } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRuleCondition.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRuleCondition.cs new file mode 100644 index 0000000000000..25bb78ea16ee2 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/ApplicationRuleCondition.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Rule condition of type application. + /// + public partial class ApplicationRuleCondition : FirewallPolicyRuleCondition + { + /// + /// Initializes a new instance of the ApplicationRuleCondition class. + /// + public ApplicationRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApplicationRuleCondition class. + /// + /// Name of the rule condition. + /// Description of the rule + /// condition. + /// List of source IP addresses for this + /// rule. + /// List of destination IP addresses + /// or Service Tags. + /// Array of Application Protocols. + /// List of FQDNs for this rule + /// condition. + /// List of FQDN Tags for this rule + /// condition. + public ApplicationRuleCondition(string name = default(string), string description = default(string), IList sourceAddresses = default(IList), IList destinationAddresses = default(IList), IList protocols = default(IList), IList targetFqdns = default(IList), IList fqdnTags = default(IList)) + : base(name, description) + { + SourceAddresses = sourceAddresses; + DestinationAddresses = destinationAddresses; + Protocols = protocols; + TargetFqdns = targetFqdns; + FqdnTags = fqdnTags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of source IP addresses for this rule. + /// + [JsonProperty(PropertyName = "sourceAddresses")] + public IList SourceAddresses { get; set; } + + /// + /// Gets or sets list of destination IP addresses or Service Tags. + /// + [JsonProperty(PropertyName = "destinationAddresses")] + public IList DestinationAddresses { get; set; } + + /// + /// Gets or sets array of Application Protocols. + /// + [JsonProperty(PropertyName = "protocols")] + public IList Protocols { get; set; } + + /// + /// Gets or sets list of FQDNs for this rule condition. + /// + [JsonProperty(PropertyName = "targetFqdns")] + public IList TargetFqdns { get; set; } + + /// + /// Gets or sets list of FQDN Tags for this rule condition. + /// + [JsonProperty(PropertyName = "fqdnTags")] + public IList FqdnTags { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewall.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewall.cs index 862220768106f..3812c58ca3e97 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewall.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewall.cs @@ -53,11 +53,17 @@ public AzureFirewall() /// The operation mode for Threat /// Intelligence. Possible values include: 'Alert', 'Deny', /// 'Off' + /// The virtualHub to which the firewall + /// belongs. + /// The firewallPolicy associated with + /// this azure firewall. + /// IP addresses associated with + /// AzureFirewall. /// A list of availability zones denoting where the /// resource needs to come from. /// Gets a unique read-only string that changes /// whenever the resource is updated. - public AzureFirewall(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList applicationRuleCollections = default(IList), IList natRuleCollections = default(IList), IList networkRuleCollections = default(IList), IList ipConfigurations = default(IList), string provisioningState = default(string), string threatIntelMode = default(string), IList zones = default(IList), string etag = default(string)) + public AzureFirewall(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList applicationRuleCollections = default(IList), IList natRuleCollections = default(IList), IList networkRuleCollections = default(IList), IList ipConfigurations = default(IList), string provisioningState = default(string), string threatIntelMode = default(string), SubResource virtualHub = default(SubResource), SubResource firewallPolicy = default(SubResource), HubIPAddresses hubIpAddresses = default(HubIPAddresses), IList zones = default(IList), string etag = default(string)) : base(id, name, type, location, tags) { ApplicationRuleCollections = applicationRuleCollections; @@ -66,6 +72,9 @@ public AzureFirewall() IpConfigurations = ipConfigurations; ProvisioningState = provisioningState; ThreatIntelMode = threatIntelMode; + VirtualHub = virtualHub; + FirewallPolicy = firewallPolicy; + HubIpAddresses = hubIpAddresses; Zones = zones; Etag = etag; CustomInit(); @@ -117,6 +126,25 @@ public AzureFirewall() [JsonProperty(PropertyName = "properties.threatIntelMode")] public string ThreatIntelMode { get; set; } + /// + /// Gets or sets the virtualHub to which the firewall belongs. + /// + [JsonProperty(PropertyName = "properties.virtualHub")] + public SubResource VirtualHub { get; set; } + + /// + /// Gets or sets the firewallPolicy associated with this azure + /// firewall. + /// + [JsonProperty(PropertyName = "properties.firewallPolicy")] + public SubResource FirewallPolicy { get; set; } + + /// + /// Gets IP addresses associated with AzureFirewall. + /// + [JsonProperty(PropertyName = "properties.hubIpAddresses")] + public HubIPAddresses HubIpAddresses { get; private set; } + /// /// Gets or sets a list of availability zones denoting where the /// resource needs to come from. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallPublicIPAddress.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallPublicIPAddress.cs new file mode 100644 index 0000000000000..eacd1bf902224 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/AzureFirewallPublicIPAddress.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Public IP Address associated with azure firewall. + /// + public partial class AzureFirewallPublicIPAddress + { + /// + /// Initializes a new instance of the AzureFirewallPublicIPAddress + /// class. + /// + public AzureFirewallPublicIPAddress() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureFirewallPublicIPAddress + /// class. + /// + /// Public IP Address value. + public AzureFirewallPublicIPAddress(string address = default(string)) + { + Address = address; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets public IP Address value. + /// + [JsonProperty(PropertyName = "address")] + public string Address { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicy.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicy.cs new file mode 100644 index 0000000000000..c81555375eaa1 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicy.cs @@ -0,0 +1,124 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +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; + + /// + /// FirewallPolicy Resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class FirewallPolicy : Resource + { + /// + /// Initializes a new instance of the FirewallPolicy class. + /// + public FirewallPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicy class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// List of references to + /// FirewallPolicyRuleGroups + /// The provisioning state of the + /// resource. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// The parent firewall policy from which + /// rules are inherited. + /// List of references to Azure Firewalls that + /// this Firewall Policy is associated with + /// List of references to Child Firewall + /// Policies + /// The operation mode for Threat + /// Intelligence. Possible values include: 'Alert', 'Deny', + /// 'Off' + /// Gets a unique read-only string that changes + /// whenever the resource is updated. + public FirewallPolicy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList ruleGroups = default(IList), string provisioningState = default(string), SubResource basePolicy = default(SubResource), IList firewalls = default(IList), IList childPolicies = default(IList), string threatIntelMode = default(string), string etag = default(string)) + : base(id, name, type, location, tags) + { + RuleGroups = ruleGroups; + ProvisioningState = provisioningState; + BasePolicy = basePolicy; + Firewalls = firewalls; + ChildPolicies = childPolicies; + ThreatIntelMode = threatIntelMode; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of references to FirewallPolicyRuleGroups + /// + [JsonProperty(PropertyName = "properties.ruleGroups")] + public IList RuleGroups { get; private set; } + + /// + /// Gets or sets the provisioning state of the resource. Possible + /// values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets or sets the parent firewall policy from which rules are + /// inherited. + /// + [JsonProperty(PropertyName = "properties.basePolicy")] + public SubResource BasePolicy { get; set; } + + /// + /// Gets list of references to Azure Firewalls that this Firewall + /// Policy is associated with + /// + [JsonProperty(PropertyName = "properties.firewalls")] + public IList Firewalls { get; private set; } + + /// + /// Gets list of references to Child Firewall Policies + /// + [JsonProperty(PropertyName = "properties.childPolicies")] + public IList ChildPolicies { get; private set; } + + /// + /// Gets or sets the operation mode for Threat Intelligence. Possible + /// values include: 'Alert', 'Deny', 'Off' + /// + [JsonProperty(PropertyName = "properties.threatIntelMode")] + public string ThreatIntelMode { get; set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRule.cs new file mode 100644 index 0000000000000..63f329ab53bd9 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRule.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Firewall Policy Filter Rule + /// + public partial class FirewallPolicyFilterRule : FirewallPolicyRule + { + /// + /// Initializes a new instance of the FirewallPolicyFilterRule class. + /// + public FirewallPolicyFilterRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyFilterRule class. + /// + /// Name of the Rule + /// Priority of the Firewall Policy Rule + /// resource. + /// The action type of a Filter rule + /// Collection of rule conditions used by + /// a rule. + public FirewallPolicyFilterRule(string name = default(string), int? priority = default(int?), FirewallPolicyFilterRuleAction action = default(FirewallPolicyFilterRuleAction), IList ruleConditions = default(IList)) + : base(name, priority) + { + Action = action; + RuleConditions = ruleConditions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the action type of a Filter rule + /// + [JsonProperty(PropertyName = "action")] + public FirewallPolicyFilterRuleAction Action { get; set; } + + /// + /// Gets or sets collection of rule conditions used by a rule. + /// + [JsonProperty(PropertyName = "ruleConditions")] + public IList RuleConditions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleAction.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleAction.cs new file mode 100644 index 0000000000000..3971a8ed7402b --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleAction.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the FirewallPolicyFilterRuleAction. + /// + public partial class FirewallPolicyFilterRuleAction + { + /// + /// Initializes a new instance of the FirewallPolicyFilterRuleAction + /// class. + /// + public FirewallPolicyFilterRuleAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyFilterRuleAction + /// class. + /// + /// The type of action. Possible values include: + /// 'Allow', 'Deny', 'Alert ' + public FirewallPolicyFilterRuleAction(string type = default(string)) + { + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of action. Possible values include: 'Allow', + /// 'Deny', 'Alert ' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleActionType.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleActionType.cs new file mode 100644 index 0000000000000..b6293b084b43e --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyFilterRuleActionType.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 +{ + + /// + /// Defines values for FirewallPolicyFilterRuleActionType. + /// + public static class FirewallPolicyFilterRuleActionType + { + public const string Allow = "Allow"; + public const string Deny = "Deny"; + public const string Alert = "Alert "; + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRule.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRule.cs new file mode 100644 index 0000000000000..7a61c07279ebd --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRule.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Firewall Policy NAT Rule + /// + public partial class FirewallPolicyNatRule : FirewallPolicyRule + { + /// + /// Initializes a new instance of the FirewallPolicyNatRule class. + /// + public FirewallPolicyNatRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyNatRule class. + /// + /// Name of the Rule + /// Priority of the Firewall Policy Rule + /// resource. + /// The action type of a Nat rule, SNAT or + /// DNAT + /// The translated address for this NAT + /// rule. + /// The translated port for this NAT + /// rule. + /// The match conditions for incoming + /// traffic + public FirewallPolicyNatRule(string name = default(string), int? priority = default(int?), FirewallPolicyNatRuleAction action = default(FirewallPolicyNatRuleAction), string translatedAddress = default(string), string translatedPort = default(string), FirewallPolicyRuleCondition ruleCondition = default(FirewallPolicyRuleCondition)) + : base(name, priority) + { + Action = action; + TranslatedAddress = translatedAddress; + TranslatedPort = translatedPort; + RuleCondition = ruleCondition; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the action type of a Nat rule, SNAT or DNAT + /// + [JsonProperty(PropertyName = "action")] + public FirewallPolicyNatRuleAction Action { get; set; } + + /// + /// Gets or sets the translated address for this NAT rule. + /// + [JsonProperty(PropertyName = "translatedAddress")] + public string TranslatedAddress { get; set; } + + /// + /// Gets or sets the translated port for this NAT rule. + /// + [JsonProperty(PropertyName = "translatedPort")] + public string TranslatedPort { get; set; } + + /// + /// Gets or sets the match conditions for incoming traffic + /// + [JsonProperty(PropertyName = "ruleCondition")] + public FirewallPolicyRuleCondition RuleCondition { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleAction.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleAction.cs new file mode 100644 index 0000000000000..f3aa96489fd4d --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleAction.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the FirewallPolicyNatRuleAction. + /// + public partial class FirewallPolicyNatRuleAction + { + /// + /// Initializes a new instance of the FirewallPolicyNatRuleAction + /// class. + /// + public FirewallPolicyNatRuleAction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyNatRuleAction + /// class. + /// + /// The type of action. Possible values include: + /// 'DNAT', 'SNAT' + public FirewallPolicyNatRuleAction(string type = default(string)) + { + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of action. Possible values include: 'DNAT', + /// 'SNAT' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleActionType.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleActionType.cs new file mode 100644 index 0000000000000..2da6217b55311 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyNatRuleActionType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 +{ + + /// + /// Defines values for FirewallPolicyNatRuleActionType. + /// + public static class FirewallPolicyNatRuleActionType + { + public const string DNAT = "DNAT"; + public const string SNAT = "SNAT"; + } +} 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 new file mode 100644 index 0000000000000..18a86aa74551e --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRule.cs @@ -0,0 +1,78 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the rule. + /// + public partial class FirewallPolicyRule + { + /// + /// Initializes a new instance of the FirewallPolicyRule class. + /// + public FirewallPolicyRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyRule class. + /// + /// Name of the Rule + /// Priority of the Firewall Policy Rule + /// resource. + public FirewallPolicyRule(string name = default(string), int? priority = default(int?)) + { + Name = name; + Priority = priority; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the Rule + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets priority of the Firewall Policy Rule resource. + /// + [JsonProperty(PropertyName = "priority")] + public int? Priority { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + 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/FirewallPolicyRuleCondition.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCondition.cs new file mode 100644 index 0000000000000..82e14173b0c81 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleCondition.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of a rule. + /// + public partial class FirewallPolicyRuleCondition + { + /// + /// Initializes a new instance of the FirewallPolicyRuleCondition + /// class. + /// + public FirewallPolicyRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyRuleCondition + /// class. + /// + /// Name of the rule condition. + /// Description of the rule + /// condition. + public FirewallPolicyRuleCondition(string name = default(string), string description = default(string)) + { + Name = name; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the rule condition. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets description of the rule condition. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocol.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocol.cs new file mode 100644 index 0000000000000..a905bfc81aac6 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocol.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties of the application rule protocol. + /// + public partial class FirewallPolicyRuleConditionApplicationProtocol + { + /// + /// Initializes a new instance of the + /// FirewallPolicyRuleConditionApplicationProtocol class. + /// + public FirewallPolicyRuleConditionApplicationProtocol() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// FirewallPolicyRuleConditionApplicationProtocol class. + /// + /// Protocol type. Possible values include: + /// 'Http', 'Https' + /// Port number for the protocol, cannot be greater + /// than 64000. + public FirewallPolicyRuleConditionApplicationProtocol(string protocolType = default(string), int? port = default(int?)) + { + ProtocolType = protocolType; + Port = port; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets protocol type. Possible values include: 'Http', + /// 'Https' + /// + [JsonProperty(PropertyName = "protocolType")] + public string ProtocolType { get; set; } + + /// + /// Gets or sets port number for the protocol, cannot be greater than + /// 64000. + /// + [JsonProperty(PropertyName = "port")] + public int? Port { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + 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/FirewallPolicyRuleConditionApplicationProtocolType.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocolType.cs new file mode 100644 index 0000000000000..ac29df4968134 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionApplicationProtocolType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 +{ + + /// + /// Defines values for FirewallPolicyRuleConditionApplicationProtocolType. + /// + public static class FirewallPolicyRuleConditionApplicationProtocolType + { + public const string Http = "Http"; + public const string Https = "Https"; + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionNetworkProtocol.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionNetworkProtocol.cs new file mode 100644 index 0000000000000..4a9a3c8608f1a --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleConditionNetworkProtocol.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 +{ + + /// + /// Defines values for FirewallPolicyRuleConditionNetworkProtocol. + /// + public static class FirewallPolicyRuleConditionNetworkProtocol + { + public const string TCP = "TCP"; + public const string UDP = "UDP"; + public const string Any = "Any"; + public const string ICMP = "ICMP"; + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleGroup.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleGroup.cs new file mode 100644 index 0000000000000..8e3c08f2c325f --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/FirewallPolicyRuleGroup.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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; + + /// + /// Rule Group resource + /// + [Rest.Serialization.JsonTransformation] + public partial class FirewallPolicyRuleGroup : SubResource + { + /// + /// Initializes a new instance of the FirewallPolicyRuleGroup class. + /// + public FirewallPolicyRuleGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FirewallPolicyRuleGroup class. + /// + /// Resource ID. + /// Priority of the Firewall Policy Rule Group + /// resource. + /// Group of Firewall Policy rules. + /// The provisioning state of the + /// resource. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// Gets name of the resource that is unique within + /// a resource group. This name can be used to access the + /// resource. + /// Gets a unique read-only string that changes + /// whenever the resource is updated. + /// Rule Group type. + public FirewallPolicyRuleGroup(string id = default(string), int? priority = default(int?), IList rules = default(IList), string provisioningState = default(string), string name = default(string), string etag = default(string), string type = default(string)) + : base(id) + { + Priority = priority; + Rules = rules; + ProvisioningState = provisioningState; + Name = name; + Etag = etag; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets priority of the Firewall Policy Rule Group resource. + /// + [JsonProperty(PropertyName = "properties.priority")] + public int? Priority { get; set; } + + /// + /// Gets or sets group of Firewall Policy rules. + /// + [JsonProperty(PropertyName = "properties.rules")] + public IList Rules { get; set; } + + /// + /// Gets or sets the provisioning state of the resource. Possible + /// values include: 'Succeeded', 'Updating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + /// + /// Gets 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 rule Group type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Priority > 65000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Priority", 65000); + } + if (Priority < 100) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Priority", 100); + } + if (Rules != null) + { + foreach (var element in Rules) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} 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/HubIPAddresses.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HubIPAddresses.cs new file mode 100644 index 0000000000000..1816d1e9693a8 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/HubIPAddresses.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// IP addresses associated with azure firewall. + /// + public partial class HubIPAddresses + { + /// + /// Initializes a new instance of the HubIPAddresses class. + /// + public HubIPAddresses() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HubIPAddresses class. + /// + /// List of Public IP addresses + /// associated with azure firewall. + /// Private IP Address associated with + /// azure firewall. + public HubIPAddresses(IList publicIPAddresses = default(IList), string privateIPAddress = default(string)) + { + PublicIPAddresses = publicIPAddresses; + PrivateIPAddress = privateIPAddress; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets list of Public IP addresses associated with azure + /// firewall. + /// + [JsonProperty(PropertyName = "publicIPAddresses")] + public IList PublicIPAddresses { get; set; } + + /// + /// Gets or sets private IP Address associated with azure firewall. + /// + [JsonProperty(PropertyName = "privateIPAddress")] + public string PrivateIPAddress { get; set; } + + } +} 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/NetworkRuleCondition.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRuleCondition.cs new file mode 100644 index 0000000000000..071d1a0b48696 --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/NetworkRuleCondition.cs @@ -0,0 +1,84 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Network.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Rule condition of type network + /// + public partial class NetworkRuleCondition : FirewallPolicyRuleCondition + { + /// + /// Initializes a new instance of the NetworkRuleCondition class. + /// + public NetworkRuleCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkRuleCondition class. + /// + /// Name of the rule condition. + /// Description of the rule + /// condition. + /// Array of + /// FirewallPolicyRuleConditionNetworkProtocols. + /// List of source IP addresses for this + /// rule. + /// List of destination IP addresses + /// or Service Tags. + /// List of destination ports. + public NetworkRuleCondition(string name = default(string), string description = default(string), IList ipProtocols = default(IList), IList sourceAddresses = default(IList), IList destinationAddresses = default(IList), IList destinationPorts = default(IList)) + : base(name, description) + { + IpProtocols = ipProtocols; + SourceAddresses = sourceAddresses; + DestinationAddresses = destinationAddresses; + DestinationPorts = destinationPorts; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets array of FirewallPolicyRuleConditionNetworkProtocols. + /// + [JsonProperty(PropertyName = "ipProtocols")] + public IList IpProtocols { get; set; } + + /// + /// Gets or sets list of source IP addresses for this rule. + /// + [JsonProperty(PropertyName = "sourceAddresses")] + public IList SourceAddresses { get; set; } + + /// + /// Gets or sets list of destination IP addresses or Service Tags. + /// + [JsonProperty(PropertyName = "destinationAddresses")] + public IList DestinationAddresses { get; set; } + + /// + /// Gets or sets list of destination ports. + /// + [JsonProperty(PropertyName = "destinationPorts")] + public IList DestinationPorts { get; set; } + + } +} diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpoint.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpoint.cs index a4722b4a17ffe..abd9204f1dbae 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpoint.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpoint.cs @@ -44,16 +44,16 @@ public PrivateEndpoint() /// Gets an array of references to the /// network interfaces created for this private endpoint. /// The provisioning state of the - /// private endpoint. Possible values are: 'Updating', 'Deleting', and - /// 'Failed'. + /// private endpoint. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' /// A grouping of /// information about the connection to the remote resource. /// A grouping of /// information about the connection to the remote resource. Used when /// the network admin does not have access to approve connections to /// the remote resource. - /// Gets a unique read-only string that changes - /// whenever the resource is updated. + /// A unique read-only string that changes whenever + /// the resource is updated. public PrivateEndpoint(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), Subnet subnet = default(Subnet), IList networkInterfaces = default(IList), string provisioningState = default(string), IList privateLinkServiceConnections = default(IList), IList manualPrivateLinkServiceConnections = default(IList), string etag = default(string)) : base(id, name, type, location, tags) { @@ -86,11 +86,12 @@ public PrivateEndpoint() public IList NetworkInterfaces { get; private set; } /// - /// Gets the provisioning state of the private endpoint. Possible - /// values are: 'Updating', 'Deleting', and 'Failed'. + /// Gets or sets the provisioning state of the private endpoint. + /// Possible values include: 'Succeeded', 'Updating', 'Deleting', + /// 'Failed' /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// /// Gets or sets a grouping of information about the connection to the @@ -108,8 +109,8 @@ public PrivateEndpoint() public IList ManualPrivateLinkServiceConnections { get; set; } /// - /// Gets a unique read-only string that changes whenever the resource - /// is updated. + /// Gets or sets a unique read-only string that changes whenever the + /// resource is updated. /// [JsonProperty(PropertyName = "etag")] public string Etag { get; set; } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpointConnection.cs index 42ee94474a589..db3bea582abb0 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateEndpointConnection.cs @@ -38,15 +38,24 @@ public PrivateEndpointConnection() /// A collection of /// information about the state of the connection between service /// consumer and provider. + /// The provisioning state of the + /// private endpoint connection. Possible values include: 'Succeeded', + /// 'Updating', 'Deleting', 'Failed' /// The name of the resource that is unique within a /// resource group. This name can be used to access the /// resource. - public PrivateEndpointConnection(string id = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string name = default(string)) + /// The resource type. + /// A unique read-only string that changes whenever + /// the resource is updated. + public PrivateEndpointConnection(string id = default(string), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string provisioningState = default(string), string name = default(string), string type = default(string), string etag = default(string)) : base(id) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; Name = name; + Type = type; + Etag = etag; CustomInit(); } @@ -68,6 +77,14 @@ public PrivateEndpointConnection() [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { 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. @@ -75,5 +92,18 @@ public PrivateEndpointConnection() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkService.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkService.cs index a10cd7f2b0529..57798274a2e3a 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkService.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkService.cs @@ -46,8 +46,8 @@ public PrivateLinkService() /// Gets an array of references to the /// network interfaces created for this private link service. /// The provisioning state of the - /// private link service. Possible values are: 'Updating', 'Succeeded', - /// and 'Failed'. + /// private link service. Possible values include: 'Succeeded', + /// 'Updating', 'Deleting', 'Failed' /// An array of list about /// connections to the private endpoint. /// The visibility list of the private link @@ -56,8 +56,8 @@ public PrivateLinkService() /// link service. /// The list of Fqdn. /// The alias of the private link service. - /// Gets a unique read-only string that changes - /// whenever the resource is updated. + /// A unique read-only string that changes whenever + /// the resource is updated. public PrivateLinkService(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), IList loadBalancerFrontendIpConfigurations = default(IList), IList ipConfigurations = default(IList), IList networkInterfaces = default(IList), string provisioningState = default(string), IList privateEndpointConnections = default(IList), PrivateLinkServicePropertiesVisibility visibility = default(PrivateLinkServicePropertiesVisibility), PrivateLinkServicePropertiesAutoApproval autoApproval = default(PrivateLinkServicePropertiesAutoApproval), IList fqdns = default(IList), string alias = default(string), string etag = default(string)) : base(id, name, type, location, tags) { @@ -101,11 +101,12 @@ public PrivateLinkService() public IList NetworkInterfaces { get; private set; } /// - /// Gets the provisioning state of the private link service. Possible - /// values are: 'Updating', 'Succeeded', and 'Failed'. + /// Gets or sets the provisioning state of the private link service. + /// Possible values include: 'Succeeded', 'Updating', 'Deleting', + /// 'Failed' /// [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } + public string ProvisioningState { get; set; } /// /// Gets or sets an array of list about connections to the private @@ -139,8 +140,8 @@ public PrivateLinkService() public string Alias { get; private set; } /// - /// Gets a unique read-only string that changes whenever the resource - /// is updated. + /// Gets or sets a unique read-only string that changes whenever the + /// resource is updated. /// [JsonProperty(PropertyName = "etag")] public string Etag { get; set; } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceConnection.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceConnection.cs index 3474fac3646b2..71dca0973e6c8 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceConnection.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceConnection.cs @@ -37,6 +37,9 @@ public PrivateLinkServiceConnection() /// class. /// /// Resource ID. + /// The provisioning state of the + /// private link service connection. Possible values include: + /// 'Succeeded', 'Updating', 'Deleting', 'Failed' /// The resource id of private link /// service. /// The ID(s) of the group(s) obtained from the @@ -51,14 +54,20 @@ public PrivateLinkServiceConnection() /// The name of the resource that is unique within a /// resource group. This name can be used to access the /// resource. - public PrivateLinkServiceConnection(string id = default(string), string privateLinkServiceId = default(string), IList groupIds = default(IList), string requestMessage = default(string), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string name = default(string)) + /// The resource type. + /// A unique read-only string that changes whenever + /// the resource is updated. + public PrivateLinkServiceConnection(string id = default(string), string provisioningState = default(string), string privateLinkServiceId = default(string), IList groupIds = default(IList), string requestMessage = default(string), PrivateLinkServiceConnectionState privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionState), string name = default(string), string type = default(string), string etag = default(string)) : base(id) { + ProvisioningState = provisioningState; PrivateLinkServiceId = privateLinkServiceId; GroupIds = groupIds; RequestMessage = requestMessage; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; Name = name; + Type = type; + Etag = etag; CustomInit(); } @@ -67,6 +76,14 @@ public PrivateLinkServiceConnection() /// partial void CustomInit(); + /// + /// Gets or sets the provisioning state of the private link service + /// connection. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + /// /// Gets or sets the resource id of private link service. /// @@ -101,5 +118,18 @@ public PrivateLinkServiceConnection() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + } } diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs index ce56978930941..0c3c7b5d410ed 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs @@ -19,7 +19,7 @@ namespace Microsoft.Azure.Management.Network.Models /// The private link service ip configuration. /// [Rest.Serialization.JsonTransformation] - public partial class PrivateLinkServiceIpConfiguration + public partial class PrivateLinkServiceIpConfiguration : SubResource { /// /// Initializes a new instance of the PrivateLinkServiceIpConfiguration @@ -34,32 +34,39 @@ public PrivateLinkServiceIpConfiguration() /// Initializes a new instance of the PrivateLinkServiceIpConfiguration /// class. /// + /// Resource ID. /// The private IP address of the IP /// configuration. /// The private IP address /// allocation method. Possible values include: 'Static', /// 'Dynamic' /// The reference of the subnet resource. - /// The reference of the public IP - /// resource. - /// Gets the provisioning state of the - /// public IP resource. Possible values are: 'Updating', 'Deleting', - /// and 'Failed'. + /// Whether the ip configuration is primary or + /// not. + /// The provisioning state of the + /// private link service ip configuration. Possible values include: + /// 'Succeeded', 'Updating', 'Deleting', 'Failed' /// Available from Api-Version /// 2016-03-30 onwards, it represents whether the specific /// ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible /// values include: 'IPv4', 'IPv6' /// The name of private link service ip /// configuration. - public PrivateLinkServiceIpConfiguration(string privateIPAddress = default(string), string privateIPAllocationMethod = default(string), Subnet subnet = default(Subnet), PublicIPAddress publicIPAddress = default(PublicIPAddress), string provisioningState = default(string), string privateIPAddressVersion = default(string), string name = default(string)) + /// A unique read-only string that changes whenever + /// the resource is updated. + /// The resource type. + public PrivateLinkServiceIpConfiguration(string id = default(string), string privateIPAddress = default(string), string privateIPAllocationMethod = default(string), Subnet subnet = default(Subnet), bool? primary = default(bool?), string provisioningState = default(string), string privateIPAddressVersion = default(string), string name = default(string), string etag = default(string), string type = default(string)) + : base(id) { PrivateIPAddress = privateIPAddress; PrivateIPAllocationMethod = privateIPAllocationMethod; Subnet = subnet; - PublicIPAddress = publicIPAddress; + Primary = primary; ProvisioningState = provisioningState; PrivateIPAddressVersion = privateIPAddressVersion; Name = name; + Etag = etag; + Type = type; CustomInit(); } @@ -88,14 +95,15 @@ public PrivateLinkServiceIpConfiguration() public Subnet Subnet { get; set; } /// - /// Gets or sets the reference of the public IP resource. + /// Gets or sets whether the ip configuration is primary or not. /// - [JsonProperty(PropertyName = "properties.publicIPAddress")] - public PublicIPAddress PublicIPAddress { get; set; } + [JsonProperty(PropertyName = "properties.primary")] + public bool? Primary { get; set; } /// - /// Gets the provisioning state of the public IP resource. Possible - /// values are: 'Updating', 'Deleting', and 'Failed'. + /// Gets or sets the provisioning state of the private link service ip + /// configuration. Possible values include: 'Succeeded', 'Updating', + /// 'Deleting', 'Failed' /// [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; set; } @@ -114,5 +122,18 @@ public PrivateLinkServiceIpConfiguration() [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 the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + } } 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/PublicIPPrefix.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPPrefix.cs index dd298535e8ae0..c484646758a7a 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPPrefix.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/PublicIPPrefix.cs @@ -49,6 +49,9 @@ public PublicIPPrefix() /// The allocated Prefix. /// The list of all referenced /// PublicIPAddresses. + /// The reference to + /// load balancer frontend IP configuration associated with the public + /// IP prefix. /// The resource GUID property of the public /// IP prefix resource. /// The provisioning state of the @@ -58,7 +61,7 @@ public PublicIPPrefix() /// the resource is updated. /// A list of availability zones denoting the IP /// allocated for the resource needs to come from. - public PublicIPPrefix(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PublicIPPrefixSku sku = default(PublicIPPrefixSku), string publicIPAddressVersion = default(string), IList ipTags = default(IList), int? prefixLength = default(int?), string ipPrefix = default(string), IList publicIPAddresses = default(IList), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string), IList zones = default(IList)) + public PublicIPPrefix(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PublicIPPrefixSku sku = default(PublicIPPrefixSku), string publicIPAddressVersion = default(string), IList ipTags = default(IList), int? prefixLength = default(int?), string ipPrefix = default(string), IList publicIPAddresses = default(IList), SubResource loadBalancerFrontendIpConfiguration = default(SubResource), string resourceGuid = default(string), string provisioningState = default(string), string etag = default(string), IList zones = default(IList)) : base(id, name, type, location, tags) { Sku = sku; @@ -67,6 +70,7 @@ public PublicIPPrefix() PrefixLength = prefixLength; IpPrefix = ipPrefix; PublicIPAddresses = publicIPAddresses; + LoadBalancerFrontendIpConfiguration = loadBalancerFrontendIpConfiguration; ResourceGuid = resourceGuid; ProvisioningState = provisioningState; Etag = etag; @@ -116,6 +120,13 @@ public PublicIPPrefix() [JsonProperty(PropertyName = "properties.publicIPAddresses")] public IList PublicIPAddresses { get; set; } + /// + /// Gets the reference to load balancer frontend IP configuration + /// associated with the public IP prefix. + /// + [JsonProperty(PropertyName = "properties.loadBalancerFrontendIpConfiguration")] + public SubResource LoadBalancerFrontendIpConfiguration { get; private set; } + /// /// Gets or sets the resource GUID property of the public IP prefix /// resource. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/UnprepareNetworkPoliciesRequest.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/UnprepareNetworkPoliciesRequest.cs new file mode 100644 index 0000000000000..74af81b0c4c5f --- /dev/null +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/Models/UnprepareNetworkPoliciesRequest.cs @@ -0,0 +1,55 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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 Newtonsoft.Json; + using System.Linq; + + /// + /// Details of UnprepareNetworkPolicies for Subnet. + /// + public partial class UnprepareNetworkPoliciesRequest + { + /// + /// Initializes a new instance of the UnprepareNetworkPoliciesRequest + /// class. + /// + public UnprepareNetworkPoliciesRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UnprepareNetworkPoliciesRequest + /// class. + /// + /// The name of the service for which subnet + /// is being unprepared for. + public UnprepareNetworkPoliciesRequest(string serviceName = default(string)) + { + ServiceName = serviceName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the service for which subnet is being + /// unprepared for. + /// + [JsonProperty(PropertyName = "serviceName")] + public string ServiceName { get; set; } + + } +} 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/NetworkManagementClient.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs index 963252593e60f..d2e079f690e0a 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/NetworkManagementClient.cs @@ -193,6 +193,16 @@ public partial class NetworkManagementClient : ServiceClient public virtual IExpressRouteLinksOperations ExpressRouteLinks { get; private set; } + /// + /// Gets the IFirewallPoliciesOperations. + /// + public virtual IFirewallPoliciesOperations FirewallPolicies { get; private set; } + + /// + /// Gets the IFirewallPolicyRuleGroupsOperations. + /// + public virtual IFirewallPolicyRuleGroupsOperations FirewallPolicyRuleGroups { get; private set; } + /// /// Gets the ILoadBalancersOperations. /// @@ -742,6 +752,8 @@ private void Initialize() ExpressRoutePortsLocations = new ExpressRoutePortsLocationsOperations(this); ExpressRoutePorts = new ExpressRoutePortsOperations(this); ExpressRouteLinks = new ExpressRouteLinksOperations(this); + FirewallPolicies = new FirewallPoliciesOperations(this); + FirewallPolicyRuleGroups = new FirewallPolicyRuleGroupsOperations(this); LoadBalancers = new LoadBalancersOperations(this); LoadBalancerBackendAddressPools = new LoadBalancerBackendAddressPoolsOperations(this); LoadBalancerFrontendIPConfigurations = new LoadBalancerFrontendIPConfigurationsOperations(this); @@ -829,6 +841,10 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleType")); + SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleConditionType")); + DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleConditionType")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); 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 c541ae2b9728f..fadd92b8afbd8 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 @@ -48,6 +48,8 @@ public static IEnumerable> ApiInfo_NetworkManageme new Tuple("Network", "ExpressRoutePorts", "2019-06-01"), new Tuple("Network", "ExpressRoutePortsLocations", "2019-06-01"), new Tuple("Network", "ExpressRouteServiceProviders", "2019-06-01"), + new Tuple("Network", "FirewallPolicies", "2019-06-01"), + new Tuple("Network", "FirewallPolicyRuleGroups", "2019-06-01"), new Tuple("Network", "HubVirtualNetworkConnections", "2019-06-01"), new Tuple("Network", "InboundNatRules", "2019-06-01"), new Tuple("Network", "LoadBalancerBackendAddressPools", "2019-06-01"), diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs index 6addc5e6580d9..cb28c68ff4b42 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperations.cs @@ -54,7 +54,10 @@ internal ServiceTagsOperations(NetworkManagementClient client) /// Gets a list of service tag information resources. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// Headers that will be added to request. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs index d575231bde963..be01db34c7b1d 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/ServiceTagsOperationsExtensions.cs @@ -28,7 +28,10 @@ public static partial class ServiceTagsOperationsExtensions /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// public static ServiceTagsListResult List(this IServiceTagsOperations operations, string location) { @@ -42,7 +45,10 @@ public static ServiceTagsListResult List(this IServiceTagsOperations operations, /// The operations group for this extension method. /// /// - /// The location. + /// The location that will be used as a reference for version (not as a filter + /// based on location, you will get the list of service tags with prefix + /// details across all regions but limited to the cloud that your subscription + /// belongs to). /// /// /// The cancellation token. diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperations.cs index f4058762ffbb5..ef6da3f0377a8 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperations.cs @@ -342,6 +342,34 @@ internal SubnetsOperations(NetworkManagementClient client) return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task UnprepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginUnprepareNetworkPoliciesWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Gets all subnets in a virtual network. /// @@ -1149,6 +1177,202 @@ internal SubnetsOperations(NetworkManagementClient client) return _result; } + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + /// + /// 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 BeginUnprepareNetworkPoliciesWithHttpMessagesAsync(string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (virtualNetworkName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "virtualNetworkName"); + } + if (subnetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "subnetName"); + } + if (unprepareNetworkPoliciesRequestParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "unprepareNetworkPoliciesRequestParameters"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-06-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("virtualNetworkName", virtualNetworkName); + tracingParameters.Add("subnetName", subnetName); + tracingParameters.Add("unprepareNetworkPoliciesRequestParameters", unprepareNetworkPoliciesRequestParameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUnprepareNetworkPolicies", 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/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}/UnprepareNetworkPolicies").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{virtualNetworkName}", System.Uri.EscapeDataString(virtualNetworkName)); + _url = _url.Replace("{subnetName}", System.Uri.EscapeDataString(subnetName)); + _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("POST"); + _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(unprepareNetworkPoliciesRequestParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(unprepareNetworkPoliciesRequestParameters, 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 != 202) + { + 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; + } + /// /// Gets all subnets in a virtual network. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperationsExtensions.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperationsExtensions.cs index 63b6c096651a9..6c640a409b68b 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperationsExtensions.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/SubnetsOperationsExtensions.cs @@ -217,6 +217,55 @@ public static void PrepareNetworkPolicies(this ISubnetsOperations operations, st (await operations.PrepareNetworkPoliciesWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + public static void UnprepareNetworkPolicies(this ISubnetsOperations operations, string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters) + { + operations.UnprepareNetworkPoliciesAsync(resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters).GetAwaiter().GetResult(); + } + + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + /// + /// The cancellation token. + /// + public static async Task UnprepareNetworkPoliciesAsync(this ISubnetsOperations operations, string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UnprepareNetworkPoliciesWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets all subnets in a virtual network. /// @@ -401,6 +450,55 @@ public static void BeginPrepareNetworkPolicies(this ISubnetsOperations operation (await operations.BeginPrepareNetworkPoliciesWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, subnetName, prepareNetworkPoliciesRequestParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + public static void BeginUnprepareNetworkPolicies(this ISubnetsOperations operations, string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters) + { + operations.BeginUnprepareNetworkPoliciesAsync(resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters).GetAwaiter().GetResult(); + } + + /// + /// Unprepares a subnet by removing network intent policies. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the virtual network. + /// + /// + /// The name of the subnet. + /// + /// + /// Parameters supplied to unprepare subnet to remove network intent policies. + /// + /// + /// The cancellation token. + /// + public static async Task BeginUnprepareNetworkPoliciesAsync(this ISubnetsOperations operations, string resourceGroupName, string virtualNetworkName, string subnetName, UnprepareNetworkPoliciesRequest unprepareNetworkPoliciesRequestParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginUnprepareNetworkPoliciesWithHttpMessagesAsync(resourceGroupName, virtualNetworkName, subnetName, unprepareNetworkPoliciesRequestParameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets all subnets in a virtual network. /// diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayConnectionsOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayConnectionsOperations.cs index 2a076374d44e8..e413c2494ac0c 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayConnectionsOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewayConnectionsOperations.cs @@ -1304,7 +1304,7 @@ internal VirtualNetworkGatewayConnectionsOperations(NetworkManagementClient clie HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try diff --git a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewaysOperations.cs b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewaysOperations.cs index 05167bd0592a2..5fa0da25c9163 100644 --- a/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewaysOperations.cs +++ b/sdk/network/Microsoft.Azure.Management.Network/src/Generated/VirtualNetworkGatewaysOperations.cs @@ -1917,7 +1917,7 @@ internal VirtualNetworkGatewaysOperations(NetworkManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try 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