From 0a5332d9420ea785a0d5e1ec44436d6396b46353 Mon Sep 17 00:00:00 2001 From: adxsdknet Date: Wed, 20 Mar 2019 17:53:40 +0000 Subject: [PATCH 1/5] .NET SDK Resource Provider:'FrontDoor' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5437' REST Spec PR Author 'eschwabe' REST Spec PR Last commit --- src/SDKs/FrontDoor/AzSdk.RP.props | 2 +- .../Generated/FrontDoorManagementClient.cs | 8 +- .../Generated/IFrontDoorManagementClient.cs | 5 + .../Generated/IManagedRuleSetsOperations.cs | 68 +++ .../Generated/IPoliciesOperations.cs | 71 +++- .../Generated/ManagedRuleSetsOperations.cs | 393 ++++++++++++++++++ .../ManagedRuleSetsOperationsExtensions.cs | 87 ++++ .../Models/{Action.cs => ActionType.cs} | 5 +- .../Models/AzureManagedOverrideRuleGroup.cs | 83 ---- .../Generated/Models/AzureManagedRuleSet.cs | 58 --- .../Generated/Models/CustomRule.cs | 65 ++- ...pOverride.cs => CustomRuleEnabledState.cs} | 8 +- .../{CustomRules.cs => CustomRuleList.cs} | 10 +- .../Generated/Models/FrontendEndpointLink.cs | 51 +++ .../Generated/Models/ManagedRuleDefinition.cs | 60 +++ .../Models/ManagedRuleEnabledState.cs | 22 + .../Models/ManagedRuleGroupDefinition.cs | 71 ++++ .../Models/ManagedRuleGroupOverride.cs | 88 ++++ .../Generated/Models/ManagedRuleOverride.cs | 89 ++++ .../Generated/Models/ManagedRuleSet.cs | 66 ++- .../Models/ManagedRuleSetDefinition.cs | 89 ++++ ...nagedRuleSets.cs => ManagedRuleSetList.cs} | 22 +- .../Generated/Models/MatchCondition.cs | 122 +++++- .../Generated/Models/MatchCondition1.cs | 120 ------ .../Generated/Models/MatchVariable.cs | 28 ++ .../Generated/Models/OperatorModel.cs | 1 + ...{EnabledState.cs => PolicyEnabledState.cs} | 4 +- .../Models/{Mode.cs => PolicyMode.cs} | 4 +- .../Generated/Models/PolicySettings.cs | 67 ++- .../Models/{Transform.cs => TransformType.cs} | 5 +- .../Models/WebApplicationFirewallPolicy1.cs | 47 ++- .../Generated/PoliciesOperations.cs | 228 +++++++--- .../Generated/PoliciesOperationsExtensions.cs | 146 ++++--- .../SdkInfo_FrontDoorManagementClient.cs | 14 +- 34 files changed, 1693 insertions(+), 514 deletions(-) create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/IManagedRuleSetsOperations.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperations.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperationsExtensions.cs rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{Action.cs => ActionType.cs} (82%) delete mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedOverrideRuleGroup.cs delete mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedRuleSet.cs rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{RuleGroupOverride.cs => CustomRuleEnabledState.cs} (69%) rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{CustomRules.cs => CustomRuleList.cs} (80%) create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/FrontendEndpointLink.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleDefinition.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleEnabledState.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupDefinition.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupOverride.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleOverride.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetDefinition.cs rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{ManagedRuleSets.cs => ManagedRuleSetList.cs} (59%) delete mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition1.cs create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchVariable.cs rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{EnabledState.cs => PolicyEnabledState.cs} (86%) rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{Mode.cs => PolicyMode.cs} (88%) rename src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/{Transform.cs => TransformType.cs} (84%) diff --git a/src/SDKs/FrontDoor/AzSdk.RP.props b/src/SDKs/FrontDoor/AzSdk.RP.props index cdcc600672527..b7c3b1f681e69 100644 --- a/src/SDKs/FrontDoor/AzSdk.RP.props +++ b/src/SDKs/FrontDoor/AzSdk.RP.props @@ -1,7 +1,7 @@ - Network_2018-08-01; + Network_2018-08-01;Network_2019-03-01; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/FrontDoorManagementClient.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/FrontDoorManagementClient.cs index e5295f7622ea5..81493f19a6a53 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/FrontDoorManagementClient.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/FrontDoorManagementClient.cs @@ -113,6 +113,11 @@ public partial class FrontDoorManagementClient : ServiceClient public virtual IPoliciesOperations Policies { get; private set; } + /// + /// Gets the IManagedRuleSetsOperations. + /// + public virtual IManagedRuleSetsOperations ManagedRuleSets { get; private set; } + /// /// Initializes a new instance of the FrontDoorManagementClient class. /// @@ -362,6 +367,7 @@ private void Initialize() FrontendEndpoints = new FrontendEndpointsOperations(this); Endpoints = new EndpointsOperations(this); Policies = new PoliciesOperations(this); + ManagedRuleSets = new ManagedRuleSetsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; @@ -392,8 +398,6 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("ruleSetType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("ruleSetType")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IFrontDoorManagementClient.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IFrontDoorManagementClient.cs index b654ed9d523f1..7056083a2841c 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IFrontDoorManagementClient.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IFrontDoorManagementClient.cs @@ -110,6 +110,11 @@ public partial interface IFrontDoorManagementClient : System.IDisposable /// IPoliciesOperations Policies { get; } + /// + /// Gets the IManagedRuleSetsOperations. + /// + IManagedRuleSetsOperations ManagedRuleSets { get; } + /// /// Check the availability of a Front Door resource name. /// diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IManagedRuleSetsOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IManagedRuleSetsOperations.cs new file mode 100644 index 0000000000000..b2dacc32b8b30 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IManagedRuleSetsOperations.cs @@ -0,0 +1,68 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedRuleSetsOperations operations. + /// + public partial interface IManagedRuleSetsOperations + { + /// + /// Lists all available managed rule sets. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all available managed rule sets. + /// + /// + /// 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/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs index ff4339941c78f..1cba472bf4b4b 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs @@ -27,7 +27,7 @@ public partial interface IPoliciesOperations /// Lists all of the protection policies within a resource group. /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// /// /// The headers that will be added to request. @@ -49,11 +49,11 @@ public partial interface IPoliciesOperations /// Retrieve protection policy with specified name within a resource /// group. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The headers that will be added to request. @@ -70,16 +70,16 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or update policy with specified rule set name within a + /// Create or update policy with specified ruleset name within a /// resource group. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// Policy to be created. @@ -99,15 +99,15 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes Policy /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The headers that will be added to request. @@ -121,15 +121,44 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes Policy + /// Create or update policy with specified ruleset name within a + /// resource group. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// + /// + /// Policy to be created. + /// + /// + /// 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 policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes Policy + /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The headers that will be added to request. @@ -143,7 +172,7 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the protection policies within a resource group. /// diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperations.cs new file mode 100644 index 0000000000000..2a79c6138f414 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperations.cs @@ -0,0 +1,393 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.FrontDoor +{ + 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; + + /// + /// ManagedRuleSetsOperations operations. + /// + internal partial class ManagedRuleSetsOperations : IServiceOperations, IManagedRuleSetsOperations + { + /// + /// Initializes a new instance of the ManagedRuleSetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedRuleSetsOperations(FrontDoorManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the FrontDoorManagementClient + /// + public FrontDoorManagementClient Client { get; private set; } + + /// + /// Lists all available managed rule sets. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2019-03-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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Network/FrontDoorWebApplicationFirewallManagedRuleSets").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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _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; + } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperationsExtensions.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperationsExtensions.cs new file mode 100644 index 0000000000000..aa45d3b5f01a8 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/ManagedRuleSetsOperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedRuleSetsOperations. + /// + public static partial class ManagedRuleSetsOperationsExtensions + { + /// + /// Lists all available managed rule sets. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IManagedRuleSetsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IManagedRuleSetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IManagedRuleSetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all available managed rule sets. + /// + /// + /// 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 IManagedRuleSetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Action.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ActionType.cs similarity index 82% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Action.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ActionType.cs index 4f16e516a4f0c..57a6e9fa05086 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Action.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ActionType.cs @@ -12,12 +12,13 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { /// - /// Defines values for Action. + /// Defines values for ActionType. /// - public static class Action + public static class ActionType { public const string Allow = "Allow"; public const string Block = "Block"; public const string Log = "Log"; + public const string Redirect = "Redirect"; } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedOverrideRuleGroup.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedOverrideRuleGroup.cs deleted file mode 100644 index 110a5f2130bae..0000000000000 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedOverrideRuleGroup.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// 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.FrontDoor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines contents of a web application rule - /// - public partial class AzureManagedOverrideRuleGroup - { - /// - /// Initializes a new instance of the AzureManagedOverrideRuleGroup - /// class. - /// - public AzureManagedOverrideRuleGroup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureManagedOverrideRuleGroup - /// class. - /// - /// Describes override rule group. - /// Possible values include: 'SqlInjection', 'XSS' - /// Type of Actions. Possible values include: - /// 'Allow', 'Block', 'Log' - public AzureManagedOverrideRuleGroup(string ruleGroupOverride, string action) - { - RuleGroupOverride = ruleGroupOverride; - Action = action; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets describes override rule group. Possible values - /// include: 'SqlInjection', 'XSS' - /// - [JsonProperty(PropertyName = "ruleGroupOverride")] - public string RuleGroupOverride { get; set; } - - /// - /// Gets or sets type of Actions. Possible values include: 'Allow', - /// 'Block', 'Log' - /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RuleGroupOverride == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RuleGroupOverride"); - } - if (Action == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Action"); - } - } - } -} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedRuleSet.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedRuleSet.cs deleted file mode 100644 index c468d91ca9702..0000000000000 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/AzureManagedRuleSet.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// 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.FrontDoor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Describes azure managed provider. - /// - public partial class AzureManagedRuleSet : ManagedRuleSet - { - /// - /// Initializes a new instance of the AzureManagedRuleSet class. - /// - public AzureManagedRuleSet() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureManagedRuleSet class. - /// - /// Describes priority of the rule - /// defines version of the rule set - /// List of azure managed provider - /// override configuration (optional) - public AzureManagedRuleSet(int? priority = default(int?), int? version = default(int?), IList ruleGroupOverrides = default(IList)) - : base(priority, version) - { - RuleGroupOverrides = ruleGroupOverrides; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of azure managed provider override configuration - /// (optional) - /// - [JsonProperty(PropertyName = "ruleGroupOverrides")] - public IList RuleGroupOverrides { get; set; } - - } -} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRule.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRule.cs index cfed8de4ab06d..9c326945c4688 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRule.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRule.cs @@ -34,32 +34,31 @@ public CustomRule() /// /// Describes priority of the rule. Rules with a /// lower value will be evaluated before rules with a higher - /// value + /// value. /// Describes type of rule. Possible values /// include: 'MatchRule', 'RateLimitRule' - /// List of match conditions - /// Type of Actions. Possible values include: - /// 'Allow', 'Block', 'Log' - /// Gets name of the resource that is unique within - /// a policy. This name can be used to access the resource. - /// Gets a unique read-only string that changes - /// whenever the resource is updated. + /// List of match conditions. + /// Describes what action to be applied when rule + /// matches. Possible values include: 'Allow', 'Block', 'Log', + /// 'Redirect' + /// Describes the name of the rule. + /// Describes if the custom rule is in + /// enabled or disabled state. Defaults to Enabled if not specified. + /// Possible values include: 'Disabled', 'Enabled' /// Defines rate limit - /// duration. Default - 1 minute + /// duration. Default is 1 minute. /// Defines rate limit - /// threshold - /// List of transforms - public CustomRule(int priority, string ruleType, IList matchConditions, string action, string name = default(string), string etag = default(string), int? rateLimitDurationInMinutes = default(int?), int? rateLimitThreshold = default(int?), IList transforms = default(IList)) + /// threshold. + public CustomRule(int priority, string ruleType, IList matchConditions, string action, string name = default(string), string enabledState = default(string), int? rateLimitDurationInMinutes = default(int?), int? rateLimitThreshold = default(int?)) { Name = name; - Etag = etag; Priority = priority; + EnabledState = enabledState; RuleType = ruleType; RateLimitDurationInMinutes = rateLimitDurationInMinutes; RateLimitThreshold = rateLimitThreshold; MatchConditions = matchConditions; Action = action; - Transforms = transforms; CustomInit(); } @@ -69,26 +68,26 @@ public CustomRule() partial void CustomInit(); /// - /// Gets name of the resource that is unique within a policy. This name - /// can be used to access the resource. + /// Gets or sets describes the name of the rule. /// [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 or sets describes priority of the rule. Rules with a lower - /// value will be evaluated before rules with a higher value + /// value will be evaluated before rules with a higher value. /// [JsonProperty(PropertyName = "priority")] public int Priority { get; set; } + /// + /// Gets or sets describes if the custom rule is in enabled or disabled + /// state. Defaults to Enabled if not specified. Possible values + /// include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "enabledState")] + public string EnabledState { get; set; } + /// /// Gets or sets describes type of rule. Possible values include: /// 'MatchRule', 'RateLimitRule' @@ -97,36 +96,30 @@ public CustomRule() public string RuleType { get; set; } /// - /// Gets or sets defines rate limit duration. Default - 1 minute + /// Gets or sets defines rate limit duration. Default is 1 minute. /// [JsonProperty(PropertyName = "rateLimitDurationInMinutes")] public int? RateLimitDurationInMinutes { get; set; } /// - /// Gets or sets defines rate limit threshold + /// Gets or sets defines rate limit threshold. /// [JsonProperty(PropertyName = "rateLimitThreshold")] public int? RateLimitThreshold { get; set; } /// - /// Gets or sets list of match conditions + /// Gets or sets list of match conditions. /// [JsonProperty(PropertyName = "matchConditions")] - public IList MatchConditions { get; set; } + public IList MatchConditions { get; set; } /// - /// Gets or sets type of Actions. Possible values include: 'Allow', - /// 'Block', 'Log' + /// Gets or sets describes what action to be applied when rule matches. + /// Possible values include: 'Allow', 'Block', 'Log', 'Redirect' /// [JsonProperty(PropertyName = "action")] public string Action { get; set; } - /// - /// Gets or sets list of transforms - /// - [JsonProperty(PropertyName = "transforms")] - public IList Transforms { get; set; } - /// /// Validate the object. /// diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/RuleGroupOverride.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleEnabledState.cs similarity index 69% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/RuleGroupOverride.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleEnabledState.cs index 1cf8b17ad593a..06e99ecb0eb33 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/RuleGroupOverride.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleEnabledState.cs @@ -12,11 +12,11 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { /// - /// Defines values for RuleGroupOverride. + /// Defines values for CustomRuleEnabledState. /// - public static class RuleGroupOverride + public static class CustomRuleEnabledState { - public const string SqlInjection = "SqlInjection"; - public const string XSS = "XSS"; + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRules.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleList.cs similarity index 80% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRules.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleList.cs index 0ead6e68b99c6..197fdf6ac64f5 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRules.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/CustomRuleList.cs @@ -18,21 +18,21 @@ namespace Microsoft.Azure.Management.FrontDoor.Models /// /// Defines contents of custom rules /// - public partial class CustomRules + public partial class CustomRuleList { /// - /// Initializes a new instance of the CustomRules class. + /// Initializes a new instance of the CustomRuleList class. /// - public CustomRules() + public CustomRuleList() { CustomInit(); } /// - /// Initializes a new instance of the CustomRules class. + /// Initializes a new instance of the CustomRuleList class. /// /// List of rules - public CustomRules(IList rules = default(IList)) + public CustomRuleList(IList rules = default(IList)) { Rules = rules; CustomInit(); diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/FrontendEndpointLink.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/FrontendEndpointLink.cs new file mode 100644 index 0000000000000..9f482d5f9806a --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/FrontendEndpointLink.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines the Resource ID for a Frontend Endpoint. + /// + public partial class FrontendEndpointLink + { + /// + /// Initializes a new instance of the FrontendEndpointLink class. + /// + public FrontendEndpointLink() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FrontendEndpointLink class. + /// + /// Resource ID. + public FrontendEndpointLink(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource ID. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleDefinition.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleDefinition.cs new file mode 100644 index 0000000000000..81dc7e9d18ab2 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleDefinition.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes a managed rule definition. + /// + public partial class ManagedRuleDefinition + { + /// + /// Initializes a new instance of the ManagedRuleDefinition class. + /// + public ManagedRuleDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleDefinition class. + /// + /// Identifier for the managed rule. + /// Describes the functionality of the + /// managed rule. + public ManagedRuleDefinition(string ruleId = default(string), string description = default(string)) + { + RuleId = ruleId; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets identifier for the managed rule. + /// + [JsonProperty(PropertyName = "ruleId")] + public string RuleId { get; private set; } + + /// + /// Gets describes the functionality of the managed rule. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleEnabledState.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleEnabledState.cs new file mode 100644 index 0000000000000..2abe1296753e0 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleEnabledState.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.FrontDoor.Models +{ + + /// + /// Defines values for ManagedRuleEnabledState. + /// + public static class ManagedRuleEnabledState + { + public const string Disabled = "Disabled"; + public const string Enabled = "Enabled"; + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupDefinition.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupDefinition.cs new file mode 100644 index 0000000000000..3375bf167077e --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupDefinition.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a managed rule group. + /// + public partial class ManagedRuleGroupDefinition + { + /// + /// Initializes a new instance of the ManagedRuleGroupDefinition class. + /// + public ManagedRuleGroupDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleGroupDefinition class. + /// + /// Name of the managed rule group. + /// Description of the managed rule + /// group. + /// List of rules within the managed rule + /// group. + public ManagedRuleGroupDefinition(string ruleGroupName = default(string), string description = default(string), IList rules = default(IList)) + { + RuleGroupName = ruleGroupName; + Description = description; + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets name of the managed rule group. + /// + [JsonProperty(PropertyName = "ruleGroupName")] + public string RuleGroupName { get; private set; } + + /// + /// Gets description of the managed rule group. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; private set; } + + /// + /// Gets list of rules within the managed rule group. + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; private set; } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupOverride.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupOverride.cs new file mode 100644 index 0000000000000..a28cb39771884 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleGroupOverride.cs @@ -0,0 +1,88 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.FrontDoor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines a managed rule group override setting. + /// + public partial class ManagedRuleGroupOverride + { + /// + /// Initializes a new instance of the ManagedRuleGroupOverride class. + /// + public ManagedRuleGroupOverride() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleGroupOverride class. + /// + /// Describes the managed rule group to + /// override. + /// List of rules that will be disabled. If none + /// specified, all rules in the group will be disabled. + public ManagedRuleGroupOverride(string ruleGroupName, IList rules = default(IList)) + { + RuleGroupName = ruleGroupName; + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes the managed rule group to override. + /// + [JsonProperty(PropertyName = "ruleGroupName")] + public string RuleGroupName { get; set; } + + /// + /// Gets or sets list of rules that will be disabled. If none + /// specified, all rules in the group will be disabled. + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RuleGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleGroupName"); + } + if (Rules != null) + { + foreach (var element in Rules) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleOverride.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleOverride.cs new file mode 100644 index 0000000000000..e223322f32c8c --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleOverride.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines a managed rule group override setting. + /// + public partial class ManagedRuleOverride + { + /// + /// Initializes a new instance of the ManagedRuleOverride class. + /// + public ManagedRuleOverride() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleOverride class. + /// + /// Identifier for the managed rule. + /// Describes if the managed rule is in + /// enabled or disabled state. Defaults to Disabled if not specified. + /// Possible values include: 'Disabled', 'Enabled' + /// Describes the override action to be applied + /// when rule matches. Possible values include: 'Allow', 'Block', + /// 'Log', 'Redirect' + public ManagedRuleOverride(string ruleId, string enabledState = default(string), string action = default(string)) + { + RuleId = ruleId; + EnabledState = enabledState; + Action = action; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets identifier for the managed rule. + /// + [JsonProperty(PropertyName = "ruleId")] + public string RuleId { get; set; } + + /// + /// Gets or sets describes if the managed rule is in enabled or + /// disabled state. Defaults to Disabled if not specified. Possible + /// values include: 'Disabled', 'Enabled' + /// + [JsonProperty(PropertyName = "enabledState")] + public string EnabledState { get; set; } + + /// + /// Gets or sets describes the override action to be applied when rule + /// matches. Possible values include: 'Allow', 'Block', 'Log', + /// 'Redirect' + /// + [JsonProperty(PropertyName = "action")] + public string Action { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RuleId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleId"); + } + } + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSet.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSet.cs index dc32c9c94110a..d34955a22aa2a 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSet.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSet.cs @@ -10,13 +10,15 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { + using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// Base class for all types of ManagedRuleSet. + /// Defines a managed rule set. /// - [Newtonsoft.Json.JsonObject("Unknown")] public partial class ManagedRuleSet { /// @@ -30,12 +32,16 @@ public ManagedRuleSet() /// /// Initializes a new instance of the ManagedRuleSet class. /// - /// Describes priority of the rule - /// defines version of the rule set - public ManagedRuleSet(int? priority = default(int?), int? version = default(int?)) + /// Defines the rule set type to use. + /// Defines the version of the rule set to + /// use. + /// Defines the rule group overrides + /// to apply to the rule set. + public ManagedRuleSet(string ruleSetType, string ruleSetVersion, IList ruleGroupOverrides = default(IList)) { - Priority = priority; - Version = version; + RuleSetType = ruleSetType; + RuleSetVersion = ruleSetVersion; + RuleGroupOverrides = ruleGroupOverrides; CustomInit(); } @@ -45,16 +51,50 @@ public ManagedRuleSet() partial void CustomInit(); /// - /// Gets or sets describes priority of the rule + /// Gets or sets defines the rule set type to use. /// - [JsonProperty(PropertyName = "priority")] - public int? Priority { get; set; } + [JsonProperty(PropertyName = "ruleSetType")] + public string RuleSetType { get; set; } /// - /// Gets or sets defines version of the rule set + /// Gets or sets defines the version of the rule set to use. /// - [JsonProperty(PropertyName = "version")] - public int? Version { get; set; } + [JsonProperty(PropertyName = "ruleSetVersion")] + public string RuleSetVersion { get; set; } + /// + /// Gets or sets defines the rule group overrides to apply to the rule + /// set. + /// + [JsonProperty(PropertyName = "ruleGroupOverrides")] + public IList RuleGroupOverrides { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (RuleSetType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleSetType"); + } + if (RuleSetVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RuleSetVersion"); + } + if (RuleGroupOverrides != null) + { + foreach (var element in RuleGroupOverrides) + { + if (element != null) + { + element.Validate(); + } + } + } + } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetDefinition.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetDefinition.cs new file mode 100644 index 0000000000000..f91aec201d308 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetDefinition.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.FrontDoor.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes the a managed rule set definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedRuleSetDefinition : Resource + { + /// + /// Initializes a new instance of the ManagedRuleSetDefinition class. + /// + public ManagedRuleSetDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedRuleSetDefinition class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// Provisioning state of the managed + /// rule set. + /// Type of the managed rule set. + /// Version of the managed rule set + /// type. + /// Rule groups of the managed rule + /// set. + public ManagedRuleSetDefinition(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string ruleSetType = default(string), string ruleSetVersion = default(string), IList ruleGroups = default(IList)) + : base(id, name, type, location, tags) + { + ProvisioningState = provisioningState; + RuleSetType = ruleSetType; + RuleSetVersion = ruleSetVersion; + RuleGroups = ruleGroups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets provisioning state of the managed rule set. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets type of the managed rule set. + /// + [JsonProperty(PropertyName = "properties.ruleSetType")] + public string RuleSetType { get; private set; } + + /// + /// Gets version of the managed rule set type. + /// + [JsonProperty(PropertyName = "properties.ruleSetVersion")] + public string RuleSetVersion { get; private set; } + + /// + /// Gets rule groups of the managed rule set. + /// + [JsonProperty(PropertyName = "properties.ruleGroups")] + public IList RuleGroups { get; private set; } + + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSets.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetList.cs similarity index 59% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSets.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetList.cs index b21c623d979b3..a47161069b4cb 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSets.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/ManagedRuleSetList.cs @@ -16,25 +16,25 @@ namespace Microsoft.Azure.Management.FrontDoor.Models using System.Linq; /// - /// Defines ManagedRuleSets - array of managedRuleSet + /// Defines the list of managed rule sets for the policy. /// - public partial class ManagedRuleSets + public partial class ManagedRuleSetList { /// - /// Initializes a new instance of the ManagedRuleSets class. + /// Initializes a new instance of the ManagedRuleSetList class. /// - public ManagedRuleSets() + public ManagedRuleSetList() { CustomInit(); } /// - /// Initializes a new instance of the ManagedRuleSets class. + /// Initializes a new instance of the ManagedRuleSetList class. /// - /// List of rules - public ManagedRuleSets(IList ruleSets = default(IList)) + /// List of rule sets. + public ManagedRuleSetList(IList managedRuleSets = default(IList)) { - RuleSets = ruleSets; + ManagedRuleSets = managedRuleSets; CustomInit(); } @@ -44,10 +44,10 @@ public ManagedRuleSets() partial void CustomInit(); /// - /// Gets or sets list of rules + /// Gets or sets list of rule sets. /// - [JsonProperty(PropertyName = "ruleSets")] - public IList RuleSets { get; set; } + [JsonProperty(PropertyName = "managedRuleSets")] + public IList ManagedRuleSets { get; set; } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition.cs index 397c6777efd52..4c77c8405079e 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition.cs @@ -10,18 +10,122 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; /// - /// Defines values for MatchCondition. + /// Define a match condition. /// - public static class MatchCondition + public partial class MatchCondition { - public const string RemoteAddr = "RemoteAddr"; - public const string RequestMethod = "RequestMethod"; - public const string QueryString = "QueryString"; - public const string PostArgs = "PostArgs"; - public const string RequestUri = "RequestUri"; - public const string RequestHeader = "RequestHeader"; - public const string RequestBody = "RequestBody"; + /// + /// Initializes a new instance of the MatchCondition class. + /// + public MatchCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MatchCondition class. + /// + /// Match variable to compare against. + /// Possible values include: 'RemoteAddr', 'RequestMethod', + /// 'QueryString', 'PostArgs', 'RequestUri', 'RequestHeader', + /// 'RequestBody', 'Cookies' + /// Describes operator to be matched. + /// Possible values include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', + /// 'Contains', 'LessThan', 'GreaterThan', 'LessThanOrEqual', + /// 'GreaterThanOrEqual', 'BeginsWith', 'EndsWith', 'RegEx' + /// List of possible match values. + /// Selector can used to match against a + /// specific key from QueryString, PostArgs, RequestHeader or + /// Cookies. + /// Describes if the result of this + /// condition should be negated. + /// List of transforms. + public MatchCondition(string matchVariable, string operatorProperty, IList matchValue, string selector = default(string), bool? negateCondition = default(bool?), IList transforms = default(IList)) + { + MatchVariable = matchVariable; + Selector = selector; + OperatorProperty = operatorProperty; + NegateCondition = negateCondition; + MatchValue = matchValue; + Transforms = transforms; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets match variable to compare against. Possible values + /// include: 'RemoteAddr', 'RequestMethod', 'QueryString', 'PostArgs', + /// 'RequestUri', 'RequestHeader', 'RequestBody', 'Cookies' + /// + [JsonProperty(PropertyName = "matchVariable")] + public string MatchVariable { get; set; } + + /// + /// Gets or sets selector can used to match against a specific key from + /// QueryString, PostArgs, RequestHeader or Cookies. + /// + [JsonProperty(PropertyName = "selector")] + public string Selector { get; set; } + + /// + /// Gets or sets describes operator to be matched. Possible values + /// include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', + /// 'LessThan', 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', + /// 'BeginsWith', 'EndsWith', 'RegEx' + /// + [JsonProperty(PropertyName = "operator")] + public string OperatorProperty { get; set; } + + /// + /// Gets or sets describes if the result of this condition should be + /// negated. + /// + [JsonProperty(PropertyName = "negateCondition")] + public bool? NegateCondition { get; set; } + + /// + /// Gets or sets list of possible match values. + /// + [JsonProperty(PropertyName = "matchValue")] + public IList MatchValue { get; set; } + + /// + /// Gets or sets list of transforms. + /// + [JsonProperty(PropertyName = "transforms")] + public IList Transforms { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MatchVariable == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchVariable"); + } + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (MatchValue == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MatchValue"); + } + } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition1.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition1.cs deleted file mode 100644 index 334b824a07dee..0000000000000 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchCondition1.cs +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// 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.FrontDoor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Define match conditions - /// - public partial class MatchCondition1 - { - /// - /// Initializes a new instance of the MatchCondition1 class. - /// - public MatchCondition1() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MatchCondition1 class. - /// - /// Match Variable. Possible values - /// include: 'RemoteAddr', 'RequestMethod', 'QueryString', 'PostArgs', - /// 'RequestUri', 'RequestHeader', 'RequestBody' - /// Describes operator to be matched. - /// Possible values include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', - /// 'Contains', 'LessThan', 'GreaterThan', 'LessThanOrEqual', - /// 'GreaterThanOrEqual', 'BeginsWith', 'EndsWith' - /// Match value - /// Name of selector in RequestHeader or - /// RequestBody to be matched - /// Describes if this is negate condition - /// or not - public MatchCondition1(string matchVariable, string operatorProperty, IList matchValue, string selector = default(string), bool? negateCondition = default(bool?)) - { - MatchVariable = matchVariable; - Selector = selector; - OperatorProperty = operatorProperty; - NegateCondition = negateCondition; - MatchValue = matchValue; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets match Variable. Possible values include: 'RemoteAddr', - /// 'RequestMethod', 'QueryString', 'PostArgs', 'RequestUri', - /// 'RequestHeader', 'RequestBody' - /// - [JsonProperty(PropertyName = "matchVariable")] - public string MatchVariable { get; set; } - - /// - /// Gets or sets name of selector in RequestHeader or RequestBody to be - /// matched - /// - [JsonProperty(PropertyName = "selector")] - public string Selector { get; set; } - - /// - /// Gets or sets describes operator to be matched. Possible values - /// include: 'Any', 'IPMatch', 'GeoMatch', 'Equal', 'Contains', - /// 'LessThan', 'GreaterThan', 'LessThanOrEqual', 'GreaterThanOrEqual', - /// 'BeginsWith', 'EndsWith' - /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } - - /// - /// Gets or sets describes if this is negate condition or not - /// - [JsonProperty(PropertyName = "negateCondition")] - public bool? NegateCondition { get; set; } - - /// - /// Gets or sets match value - /// - [JsonProperty(PropertyName = "matchValue")] - public IList MatchValue { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MatchVariable == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MatchVariable"); - } - if (OperatorProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); - } - if (MatchValue == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MatchValue"); - } - } - } -} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchVariable.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchVariable.cs new file mode 100644 index 0000000000000..c2b72181268f6 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/MatchVariable.cs @@ -0,0 +1,28 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.FrontDoor.Models +{ + + /// + /// Defines values for MatchVariable. + /// + public static class MatchVariable + { + public const string RemoteAddr = "RemoteAddr"; + public const string RequestMethod = "RequestMethod"; + public const string QueryString = "QueryString"; + public const string PostArgs = "PostArgs"; + public const string RequestUri = "RequestUri"; + public const string RequestHeader = "RequestHeader"; + public const string RequestBody = "RequestBody"; + public const string Cookies = "Cookies"; + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/OperatorModel.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/OperatorModel.cs index da878210e41c3..04b6ef4d3e326 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/OperatorModel.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/OperatorModel.cs @@ -27,5 +27,6 @@ public static class OperatorModel public const string GreaterThanOrEqual = "GreaterThanOrEqual"; public const string BeginsWith = "BeginsWith"; public const string EndsWith = "EndsWith"; + public const string RegEx = "RegEx"; } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/EnabledState.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyEnabledState.cs similarity index 86% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/EnabledState.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyEnabledState.cs index 56e94b583e77c..0c78a3efe4159 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/EnabledState.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyEnabledState.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { /// - /// Defines values for EnabledState. + /// Defines values for PolicyEnabledState. /// - public static class EnabledState + public static class PolicyEnabledState { public const string Disabled = "Disabled"; public const string Enabled = "Enabled"; diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Mode.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyMode.cs similarity index 88% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Mode.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyMode.cs index dd600bc3cd386..65850bb32f119 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Mode.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyMode.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { /// - /// Defines values for Mode. + /// Defines values for PolicyMode. /// - public static class Mode + public static class PolicyMode { public const string Prevention = "Prevention"; public const string Detection = "Detection"; diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicySettings.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicySettings.cs index 5244420cee747..27c7c00960549 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicySettings.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicySettings.cs @@ -10,11 +10,12 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; /// - /// Defines contents of a web application firewall global configuration + /// Defines top-level WebApplicationFirewallPolicy configuration settings. /// public partial class PolicySettings { @@ -29,16 +30,26 @@ public PolicySettings() /// /// Initializes a new instance of the PolicySettings class. /// - /// describes if the policy is in enabled - /// state or disabled state. Possible values include: 'Disabled', - /// 'Enabled' - /// Describes if it is in detection mode or + /// Describes if the policy is in enabled or + /// disabled state. Defaults to Enabled if not specified. Possible + /// values include: 'Disabled', 'Enabled' + /// Describes if it is in detection mode or /// prevention mode at policy level. Possible values include: /// 'Prevention', 'Detection' - public PolicySettings(string enabledState = default(string), string mode = default(string)) + /// If action type is redirect, this field + /// represents redirect URL for the client. + /// If the action type is + /// block, customer can override the response status code. + /// If the action type is block, + /// customer can override the response body. The body must be specified + /// in base64 encoding. + public PolicySettings(string enabledState = default(string), string mode = default(string), string redirectUrl = default(string), int? customBlockResponseStatusCode = default(int?), string customBlockResponseBody = default(string)) { EnabledState = enabledState; Mode = mode; + RedirectUrl = redirectUrl; + CustomBlockResponseStatusCode = customBlockResponseStatusCode; + CustomBlockResponseBody = customBlockResponseBody; CustomInit(); } @@ -48,19 +59,57 @@ public PolicySettings() partial void CustomInit(); /// - /// Gets or sets describes if the policy is in enabled state or - /// disabled state. Possible values include: 'Disabled', 'Enabled' + /// Gets or sets describes if the policy is in enabled or disabled + /// state. Defaults to Enabled if not specified. Possible values + /// include: 'Disabled', 'Enabled' /// [JsonProperty(PropertyName = "enabledState")] public string EnabledState { get; set; } /// - /// Gets or sets describes if it is in detection mode or prevention + /// Gets or sets describes if it is in detection mode or prevention /// mode at policy level. Possible values include: 'Prevention', /// 'Detection' /// [JsonProperty(PropertyName = "mode")] public string Mode { get; set; } + /// + /// Gets or sets if action type is redirect, this field represents + /// redirect URL for the client. + /// + [JsonProperty(PropertyName = "redirectUrl")] + public string RedirectUrl { get; set; } + + /// + /// Gets or sets if the action type is block, customer can override the + /// response status code. + /// + [JsonProperty(PropertyName = "customBlockResponseStatusCode")] + public int? CustomBlockResponseStatusCode { get; set; } + + /// + /// Gets or sets if the action type is block, customer can override the + /// response body. The body must be specified in base64 encoding. + /// + [JsonProperty(PropertyName = "customBlockResponseBody")] + public string CustomBlockResponseBody { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (CustomBlockResponseBody != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(CustomBlockResponseBody, "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$")) + { + throw new ValidationException(ValidationRules.Pattern, "CustomBlockResponseBody", "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$"); + } + } + } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Transform.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/TransformType.cs similarity index 84% rename from src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Transform.cs rename to src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/TransformType.cs index 1256ba56be6b9..d737b453d5093 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/Transform.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/TransformType.cs @@ -12,9 +12,9 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { /// - /// Defines values for Transform. + /// Defines values for TransformType. /// - public static class Transform + public static class TransformType { public const string Lowercase = "Lowercase"; public const string Uppercase = "Uppercase"; @@ -22,6 +22,5 @@ public static class Transform public const string UrlDecode = "UrlDecode"; public const string UrlEncode = "UrlEncode"; public const string RemoveNulls = "RemoveNulls"; - public const string HtmlEntityDecode = "HtmlEntityDecode"; } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs index 743a4c456c3aa..38f9bc04ebc3b 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs @@ -41,23 +41,26 @@ public WebApplicationFirewallPolicy1() /// Resource type. /// Resource location. /// Resource tags. - /// Describes policySettings for - /// policy + /// Describes settings for the + /// policy. /// Describes custom rules inside the - /// policy + /// policy. /// Describes managed rules inside the - /// policy + /// policy. + /// Describes Frontend Endpoints + /// associated with this Web Application Firewall policy. /// Provisioning state of the - /// WebApplicationFirewallPolicy. + /// policy. /// Resource status of the policy. /// Gets a unique read-only string that changes /// whenever the resource is updated. - public WebApplicationFirewallPolicy1(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PolicySettings policySettings = default(PolicySettings), CustomRules customRules = default(CustomRules), ManagedRuleSets managedRules = default(ManagedRuleSets), string provisioningState = default(string), string resourceState = default(string), string etag = default(string)) + public WebApplicationFirewallPolicy1(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PolicySettings policySettings = default(PolicySettings), CustomRuleList customRules = default(CustomRuleList), ManagedRuleSetList managedRules = default(ManagedRuleSetList), IList frontendEndpointLinks = default(IList), string provisioningState = default(string), string resourceState = default(string), string etag = default(string)) : base(id, name, type, location, tags) { PolicySettings = policySettings; CustomRules = customRules; ManagedRules = managedRules; + FrontendEndpointLinks = frontendEndpointLinks; ProvisioningState = provisioningState; ResourceState = resourceState; Etag = etag; @@ -70,25 +73,32 @@ public WebApplicationFirewallPolicy1() partial void CustomInit(); /// - /// Gets or sets describes policySettings for policy + /// Gets or sets describes settings for the policy. /// [JsonProperty(PropertyName = "properties.policySettings")] public PolicySettings PolicySettings { get; set; } /// - /// Gets or sets describes custom rules inside the policy + /// Gets or sets describes custom rules inside the policy. /// [JsonProperty(PropertyName = "properties.customRules")] - public CustomRules CustomRules { get; set; } + public CustomRuleList CustomRules { get; set; } /// - /// Gets or sets describes managed rules inside the policy + /// Gets or sets describes managed rules inside the policy. /// [JsonProperty(PropertyName = "properties.managedRules")] - public ManagedRuleSets ManagedRules { get; set; } + public ManagedRuleSetList ManagedRules { get; set; } /// - /// Gets provisioning state of the WebApplicationFirewallPolicy. + /// Gets describes Frontend Endpoints associated with this Web + /// Application Firewall policy. + /// + [JsonProperty(PropertyName = "properties.frontendEndpointLinks")] + public IList FrontendEndpointLinks { get; private set; } + + /// + /// Gets provisioning state of the policy. /// [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; private set; } @@ -110,5 +120,18 @@ public WebApplicationFirewallPolicy1() [JsonProperty(PropertyName = "etag")] public string Etag { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PolicySettings != null) + { + PolicySettings.Validate(); + } + } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs index 66fe53465e22a..0a9237cec6ae5 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs @@ -54,7 +54,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// Lists all of the protection policies within a resource group. /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// /// /// Headers that will be added to request. @@ -83,11 +83,26 @@ internal PoliciesOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 80); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-08-01"; + string apiVersion = "2019-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -233,11 +248,11 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// Retrieve protection policy with specified name within a resource group. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// Headers that will be added to request. @@ -260,12 +275,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } if (policyName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); @@ -277,11 +288,30 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); } } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 80); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-08-01"; + string apiVersion = "2019-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -289,8 +319,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("policyName", policyName); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -298,8 +328,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) // 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -427,14 +457,62 @@ internal PoliciesOperations(FrontDoorManagementClient client) } /// - /// Creates or update policy with specified rule set name within a resource + /// Create or update policy with specified ruleset name within a resource /// group. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// + /// + /// Policy to be created. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes Policy + /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(policyName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update policy with specified ruleset name within a resource + /// group. + /// + /// + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// Policy to be created. @@ -460,12 +538,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } if (policyName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); @@ -477,6 +551,25 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); } } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 80); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -485,7 +578,11 @@ internal PoliciesOperations(FrontDoorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2018-08-01"; + if (parameters != null) + { + parameters.Validate(); + } + string apiVersion = "2019-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -493,18 +590,18 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("policyName", policyName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -575,7 +672,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -648,6 +745,24 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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); @@ -658,33 +773,11 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// Deletes Policy /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. + /// The name of the Web Application Firewall Policy. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, policyName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes Policy - /// /// - /// The name of the resource group. - /// - /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// /// /// Headers that will be added to request. @@ -704,12 +797,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } if (policyName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); @@ -721,11 +810,30 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); } } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 80); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2018-08-01"; + string apiVersion = "2019-03-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -733,8 +841,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("policyName", policyName); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -742,8 +850,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) // 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs index 7e985a8a25f4f..af267c67e79fe 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class PoliciesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// public static IPage List(this IPoliciesOperations operations, string resourceGroupName) { @@ -42,7 +42,7 @@ public static IPage List(this IPoliciesOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. /// /// /// The cancellation token. @@ -61,15 +61,15 @@ public static IPage List(this IPoliciesOperations /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// - public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operations, string resourceGroupName, string policyName) + public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operations, string policyName, string resourceGroupName) { - return operations.GetAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); + return operations.GetAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); } /// @@ -78,56 +78,56 @@ public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The cancellation token. /// - public static async Task GetAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Creates or update policy with specified rule set name within a resource + /// Create or update policy with specified ruleset name within a resource /// group. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// Policy to be created. /// - public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy1 parameters) + public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters) { - return operations.CreateOrUpdateAsync(resourceGroupName, policyName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(policyName, resourceGroupName, parameters).GetAwaiter().GetResult(); } /// - /// Creates or update policy with specified rule set name within a resource + /// Create or update policy with specified ruleset name within a resource /// group. /// /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// Policy to be created. @@ -135,9 +135,9 @@ public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperati /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy1 parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -149,15 +149,15 @@ public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperati /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// - public static void Delete(this IPoliciesOperations operations, string resourceGroupName, string policyName) + public static void Delete(this IPoliciesOperations operations, string policyName, string resourceGroupName) { - operations.DeleteAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); + operations.DeleteAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); } /// @@ -166,35 +166,66 @@ public static void Delete(this IPoliciesOperations operations, string resourceGr /// /// The operations group for this extension method. /// - /// - /// The name of the resource group. - /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Deletes Policy + /// Create or update policy with specified ruleset name within a resource + /// group. /// /// /// The operations group for this extension method. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Policy to be created. + /// + public static WebApplicationFirewallPolicy1 BeginCreateOrUpdate(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters) + { + return operations.BeginCreateOrUpdateAsync(policyName, resourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Create or update policy with specified ruleset name within a resource + /// group. + /// + /// + /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. + /// + /// + /// Policy to be created. + /// + /// + /// The cancellation token. /// - public static void BeginDelete(this IPoliciesOperations operations, string resourceGroupName, string policyName) + public static async Task BeginCreateOrUpdateAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, CancellationToken cancellationToken = default(CancellationToken)) { - operations.BeginDeleteAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -203,18 +234,35 @@ public static void BeginDelete(this IPoliciesOperations operations, string resou /// /// The operations group for this extension method. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// - /// The name of the resource group. + /// Name of the Resource group within the Azure subscription. + /// + public static void BeginDelete(this IPoliciesOperations operations, string policyName, string resourceGroupName) + { + operations.BeginDeleteAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes Policy + /// + /// + /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the Web Application Firewall Policy. + /// + /// + /// Name of the Resource group within the Azure subscription. /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs index c045cc5e4f977..7ed0d8e64d329 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs @@ -27,21 +27,11 @@ public static IEnumerable> ApiInfo_FrontDoorManage new Tuple("Network", "FrontendEndpoints", "2018-08-01"), new Tuple("Network", "HealthProbeSettings", "2018-08-01"), new Tuple("Network", "LoadBalancingSettings", "2018-08-01"), - new Tuple("Network", "Policies", "2018-08-01"), + new Tuple("Network", "ManagedRuleSets", "2019-03-01"), + new Tuple("Network", "Policies", "2019-03-01"), new Tuple("Network", "RoutingRules", "2018-08-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/frontdoor/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "b1de6f7bf1e46357686aabc7ab1ae3c274790148"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - From 5c7fe2c66e2ee18e3d83c6dfaba4fd7b3e0743a3 Mon Sep 17 00:00:00 2001 From: adxsdknet Date: Wed, 20 Mar 2019 21:28:21 +0000 Subject: [PATCH 2/5] .NET SDK Resource Provider:'FrontDoor' REST Spec PR 'https://github.com/Azure/azure-rest-api-specs/pull/5437' REST Spec PR Author 'eschwabe' REST Spec PR Last commit --- .../Generated/IPoliciesOperations.cs | 44 +++--- .../Generated/Models/PolicyResourceState.cs | 26 ++++ .../Models/WebApplicationFirewallPolicy.cs | 127 ++++++++++++++- .../Models/WebApplicationFirewallPolicy1.cs | 137 ---------------- .../Generated/PoliciesOperations.cs | 146 +++++++++--------- .../Generated/PoliciesOperationsExtensions.cs | 108 ++++++------- 6 files changed, 294 insertions(+), 294 deletions(-) create mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyResourceState.cs delete mode 100644 src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs index 1cba472bf4b4b..bb0f4fb184035 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/IPoliciesOperations.cs @@ -44,17 +44,17 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieve protection policy with specified name within a resource /// group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The headers that will be added to request. /// @@ -70,17 +70,17 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update policy with specified ruleset name within a /// resource group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// @@ -99,16 +99,16 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes Policy /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The headers that will be added to request. /// @@ -121,17 +121,17 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update policy with specified ruleset name within a /// resource group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// @@ -150,16 +150,16 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes Policy /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The headers that will be added to request. /// @@ -172,7 +172,7 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all of the protection policies within a resource group. /// @@ -194,6 +194,6 @@ public partial interface IPoliciesOperations /// /// Thrown when a required parameter is null /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyResourceState.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyResourceState.cs new file mode 100644 index 0000000000000..e4d28dfdcd2b4 --- /dev/null +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/PolicyResourceState.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// 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.FrontDoor.Models +{ + + /// + /// Defines values for PolicyResourceState. + /// + public static class PolicyResourceState + { + public const string Creating = "Creating"; + public const string Enabling = "Enabling"; + public const string Enabled = "Enabled"; + public const string Disabling = "Disabling"; + public const string Disabled = "Disabled"; + public const string Deleting = "Deleting"; + } +} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy.cs index e5f8799b83aea..dbc4bfe3b0844 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy.cs @@ -10,17 +10,128 @@ namespace Microsoft.Azure.Management.FrontDoor.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; /// - /// Defines values for WebApplicationFirewallPolicy. + /// Defines web application firewall policy. /// - public static class WebApplicationFirewallPolicy + [Rest.Serialization.JsonTransformation] + public partial class WebApplicationFirewallPolicy : Resource { - public const string Creating = "Creating"; - public const string Enabling = "Enabling"; - public const string Enabled = "Enabled"; - public const string Disabling = "Disabling"; - public const string Disabled = "Disabled"; - public const string Deleting = "Deleting"; + /// + /// Initializes a new instance of the WebApplicationFirewallPolicy + /// class. + /// + public WebApplicationFirewallPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WebApplicationFirewallPolicy + /// class. + /// + /// Resource ID. + /// Resource name. + /// Resource type. + /// Resource location. + /// Resource tags. + /// Describes settings for the + /// policy. + /// Describes custom rules inside the + /// policy. + /// Describes managed rules inside the + /// policy. + /// Describes Frontend Endpoints + /// associated with this Web Application Firewall policy. + /// Provisioning state of the + /// policy. + /// Resource status of the policy. + /// Gets a unique read-only string that changes + /// whenever the resource is updated. + public WebApplicationFirewallPolicy(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PolicySettings policySettings = default(PolicySettings), CustomRuleList customRules = default(CustomRuleList), ManagedRuleSetList managedRules = default(ManagedRuleSetList), IList frontendEndpointLinks = default(IList), string provisioningState = default(string), string resourceState = default(string), string etag = default(string)) + : base(id, name, type, location, tags) + { + PolicySettings = policySettings; + CustomRules = customRules; + ManagedRules = managedRules; + FrontendEndpointLinks = frontendEndpointLinks; + ProvisioningState = provisioningState; + ResourceState = resourceState; + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes settings for the policy. + /// + [JsonProperty(PropertyName = "properties.policySettings")] + public PolicySettings PolicySettings { get; set; } + + /// + /// Gets or sets describes custom rules inside the policy. + /// + [JsonProperty(PropertyName = "properties.customRules")] + public CustomRuleList CustomRules { get; set; } + + /// + /// Gets or sets describes managed rules inside the policy. + /// + [JsonProperty(PropertyName = "properties.managedRules")] + public ManagedRuleSetList ManagedRules { get; set; } + + /// + /// Gets describes Frontend Endpoints associated with this Web + /// Application Firewall policy. + /// + [JsonProperty(PropertyName = "properties.frontendEndpointLinks")] + public IList FrontendEndpointLinks { get; private set; } + + /// + /// Gets provisioning state of the policy. + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets resource status of the policy. + /// + /// + /// Possible values include: 'Creating', 'Enabling', 'Enabled', + /// 'Disabling', 'Disabled', 'Deleting' + /// + [JsonProperty(PropertyName = "properties.resourceState")] + public string ResourceState { get; private set; } + + /// + /// Gets a unique read-only string that changes whenever the resource + /// is updated. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PolicySettings != null) + { + PolicySettings.Validate(); + } + } } } diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs deleted file mode 100644 index 38f9bc04ebc3b..0000000000000 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/Models/WebApplicationFirewallPolicy1.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// 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.FrontDoor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Defines web application firewall policy. - /// - [Rest.Serialization.JsonTransformation] - public partial class WebApplicationFirewallPolicy1 : Resource - { - /// - /// Initializes a new instance of the WebApplicationFirewallPolicy1 - /// class. - /// - public WebApplicationFirewallPolicy1() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WebApplicationFirewallPolicy1 - /// class. - /// - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource location. - /// Resource tags. - /// Describes settings for the - /// policy. - /// Describes custom rules inside the - /// policy. - /// Describes managed rules inside the - /// policy. - /// Describes Frontend Endpoints - /// associated with this Web Application Firewall policy. - /// Provisioning state of the - /// policy. - /// Resource status of the policy. - /// Gets a unique read-only string that changes - /// whenever the resource is updated. - public WebApplicationFirewallPolicy1(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), PolicySettings policySettings = default(PolicySettings), CustomRuleList customRules = default(CustomRuleList), ManagedRuleSetList managedRules = default(ManagedRuleSetList), IList frontendEndpointLinks = default(IList), string provisioningState = default(string), string resourceState = default(string), string etag = default(string)) - : base(id, name, type, location, tags) - { - PolicySettings = policySettings; - CustomRules = customRules; - ManagedRules = managedRules; - FrontendEndpointLinks = frontendEndpointLinks; - ProvisioningState = provisioningState; - ResourceState = resourceState; - Etag = etag; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets describes settings for the policy. - /// - [JsonProperty(PropertyName = "properties.policySettings")] - public PolicySettings PolicySettings { get; set; } - - /// - /// Gets or sets describes custom rules inside the policy. - /// - [JsonProperty(PropertyName = "properties.customRules")] - public CustomRuleList CustomRules { get; set; } - - /// - /// Gets or sets describes managed rules inside the policy. - /// - [JsonProperty(PropertyName = "properties.managedRules")] - public ManagedRuleSetList ManagedRules { get; set; } - - /// - /// Gets describes Frontend Endpoints associated with this Web - /// Application Firewall policy. - /// - [JsonProperty(PropertyName = "properties.frontendEndpointLinks")] - public IList FrontendEndpointLinks { get; private set; } - - /// - /// Gets provisioning state of the policy. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets resource status of the policy. - /// - /// - /// Possible values include: 'Creating', 'Enabling', 'Enabled', - /// 'Disabling', 'Disabled', 'Deleting' - /// - [JsonProperty(PropertyName = "properties.resourceState")] - public string ResourceState { get; private set; } - - /// - /// Gets a unique read-only string that changes whenever the resource - /// is updated. - /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PolicySettings != null) - { - PolicySettings.Validate(); - } - } - } -} diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs index 0a9237cec6ae5..05a18a0ea55d9 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperations.cs @@ -77,7 +77,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -213,7 +213,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -226,7 +226,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -248,12 +248,12 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// Retrieve protection policy with specified name within a resource group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Headers that will be added to request. /// @@ -275,19 +275,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (policyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); - } - if (policyName != null) - { - if (policyName.Length > 128) - { - throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); - } - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -307,6 +296,17 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); } } + if (policyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); + } + if (policyName != null) + { + if (policyName.Length > 128) + { + throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -319,8 +319,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("policyName", policyName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -328,8 +328,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) // 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -424,7 +424,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -437,7 +437,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -460,12 +460,12 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// Create or update policy with specified ruleset name within a resource /// group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// @@ -475,32 +475,32 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// /// Deletes Policy /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(policyName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, policyName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -508,12 +508,12 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// Create or update policy with specified ruleset name within a resource /// group. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// @@ -538,19 +538,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (policyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); - } - if (policyName != null) - { - if (policyName.Length > 128) - { - throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); - } - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -570,6 +559,17 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); } } + if (policyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); + } + if (policyName != null) + { + if (policyName.Length > 128) + { + throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -590,8 +590,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("policyName", policyName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); @@ -600,8 +600,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) // 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -702,7 +702,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -715,7 +715,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -733,7 +733,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -751,7 +751,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -773,12 +773,12 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// Deletes Policy /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Headers that will be added to request. /// @@ -797,19 +797,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string policyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string policyName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (policyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); - } - if (policyName != null) - { - if (policyName.Length > 128) - { - throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); - } - } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); @@ -829,6 +818,17 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"); } } + if (policyName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policyName"); + } + if (policyName != null) + { + if (policyName.Length > 128) + { + throw new ValidationException(ValidationRules.MaxLength, "policyName", 128); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -841,8 +841,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("policyName", policyName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("policyName", policyName); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); @@ -850,8 +850,8 @@ internal PoliciesOperations(FrontDoorManagementClient client) // 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/FrontDoorWebApplicationFirewallPolicies/{policyName}").ToString(); - _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{policyName}", System.Uri.EscapeDataString(policyName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); if (apiVersion != null) @@ -992,7 +992,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (nextPageLink == null) { @@ -1101,7 +1101,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1114,7 +1114,7 @@ internal PoliciesOperations(FrontDoorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs index af267c67e79fe..c924fcfd301d9 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/PoliciesOperationsExtensions.cs @@ -30,7 +30,7 @@ public static partial class PoliciesOperationsExtensions /// /// Name of the Resource group within the Azure subscription. /// - public static IPage List(this IPoliciesOperations operations, string resourceGroupName) + public static IPage List(this IPoliciesOperations operations, string resourceGroupName) { return operations.ListAsync(resourceGroupName).GetAwaiter().GetResult(); } @@ -47,7 +47,7 @@ public static IPage List(this IPoliciesOperations /// /// The cancellation token. /// - public static async Task> ListAsync(this IPoliciesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListAsync(this IPoliciesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -61,15 +61,15 @@ public static IPage List(this IPoliciesOperations /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// - public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operations, string policyName, string resourceGroupName) + /// + /// The name of the Web Application Firewall Policy. + /// + public static WebApplicationFirewallPolicy Get(this IPoliciesOperations operations, string resourceGroupName, string policyName) { - return operations.GetAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); } /// @@ -78,18 +78,18 @@ public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operati /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The cancellation token. /// - public static async Task GetAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -102,18 +102,18 @@ public static WebApplicationFirewallPolicy1 Get(this IPoliciesOperations operati /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// - public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters) + public static WebApplicationFirewallPolicy CreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters) { - return operations.CreateOrUpdateAsync(policyName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, policyName, parameters).GetAwaiter().GetResult(); } /// @@ -123,21 +123,21 @@ public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperati /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -149,15 +149,15 @@ public static WebApplicationFirewallPolicy1 CreateOrUpdate(this IPoliciesOperati /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// - public static void Delete(this IPoliciesOperations operations, string policyName, string resourceGroupName) + /// + /// The name of the Web Application Firewall Policy. + /// + public static void Delete(this IPoliciesOperations operations, string resourceGroupName, string policyName) { - operations.DeleteAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); } /// @@ -166,18 +166,18 @@ public static void Delete(this IPoliciesOperations operations, string policyName /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -187,18 +187,18 @@ public static void Delete(this IPoliciesOperations operations, string policyName /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// - public static WebApplicationFirewallPolicy1 BeginCreateOrUpdate(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters) + public static WebApplicationFirewallPolicy BeginCreateOrUpdate(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters) { - return operations.BeginCreateOrUpdateAsync(policyName, resourceGroupName, parameters).GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, policyName, parameters).GetAwaiter().GetResult(); } /// @@ -208,21 +208,21 @@ public static WebApplicationFirewallPolicy1 BeginCreateOrUpdate(this IPoliciesOp /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// Policy to be created. /// /// /// The cancellation token. /// - public static async Task BeginCreateOrUpdateAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, WebApplicationFirewallPolicy1 parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, WebApplicationFirewallPolicy parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(policyName, resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, policyName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -234,15 +234,15 @@ public static WebApplicationFirewallPolicy1 BeginCreateOrUpdate(this IPoliciesOp /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// - public static void BeginDelete(this IPoliciesOperations operations, string policyName, string resourceGroupName) + /// + /// The name of the Web Application Firewall Policy. + /// + public static void BeginDelete(this IPoliciesOperations operations, string resourceGroupName, string policyName) { - operations.BeginDeleteAsync(policyName, resourceGroupName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, policyName).GetAwaiter().GetResult(); } /// @@ -251,18 +251,18 @@ public static void BeginDelete(this IPoliciesOperations operations, string polic /// /// The operations group for this extension method. /// - /// - /// The name of the Web Application Firewall Policy. - /// /// /// Name of the Resource group within the Azure subscription. /// + /// + /// The name of the Web Application Firewall Policy. + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IPoliciesOperations operations, string policyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IPoliciesOperations operations, string resourceGroupName, string policyName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(policyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, policyName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -274,7 +274,7 @@ public static void BeginDelete(this IPoliciesOperations operations, string polic /// /// The NextLink from the previous successful call to List operation. /// - public static IPage ListNext(this IPoliciesOperations operations, string nextPageLink) + public static IPage ListNext(this IPoliciesOperations operations, string nextPageLink) { return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); } @@ -291,7 +291,7 @@ public static IPage ListNext(this IPoliciesOperat /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListNextAsync(this IPoliciesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { From e4783ac188efa6700482dbe7156a708ff0a354ac Mon Sep 17 00:00:00 2001 From: Eric Schwabe Date: Wed, 20 Mar 2019 17:35:29 -0700 Subject: [PATCH 3/5] Fix unit tests to work with 2019-03-01-preview API --- .../ScenarioTests/FrontDoorTests.cs | 52 +++++++++++-------- .../WAFCRUDTest.json | 30 +++++------ 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs b/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs index 3752f04a04824..c39083733bfb0 100644 --- a/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs +++ b/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs @@ -155,20 +155,20 @@ public void WAFCRUDTest() // Create a frontDoor string policyName = TestUtilities.GenerateName("policy"); - WebApplicationFirewallPolicy1 createParameters = new WebApplicationFirewallPolicy1 + WebApplicationFirewallPolicy createParameters = new WebApplicationFirewallPolicy { Location = "global", Tags = new Dictionary - { - {"key1","value1"}, - {"key2","value2"} - }, + { + {"key1","value1"}, + {"key2","value2"} + }, PolicySettings = new PolicySettings { EnabledState = "Enabled", Mode = "Prevention" }, - CustomRules = new CustomRules( + CustomRules = new CustomRuleList( new List { new CustomRule @@ -177,9 +177,9 @@ public void WAFCRUDTest() Priority = 1, RuleType = "RateLimitRule", RateLimitThreshold = 1000, - MatchConditions = new List + MatchConditions = new List { - new MatchCondition1 + new MatchCondition { MatchVariable = "RemoteAddr", OperatorProperty = "IPMatch", @@ -194,18 +194,27 @@ public void WAFCRUDTest() } } ), - ManagedRules = new ManagedRuleSets( + ManagedRules = new ManagedRuleSetList( new List { - new AzureManagedRuleSet + new ManagedRuleSet { - Priority = 1, - RuleGroupOverrides = new List + RuleSetType = "DefaultRuleSet", + RuleSetVersion = "1.0", + RuleGroupOverrides = new List { - new AzureManagedOverrideRuleGroup + new ManagedRuleGroupOverride { - RuleGroupOverride = "SqlInjection", - Action = "Block" - }, + RuleGroupName = "SQLI", + Rules = new List + { + new ManagedRuleOverride + { + RuleId = "Rule1", + Action = "Redirect", + EnabledState = "Disabled" + } + } + } } } @@ -230,9 +239,9 @@ public void WAFCRUDTest() Name = "rule2", Priority = 2, RuleType = "MatchRule", - MatchConditions = new List + MatchConditions = new List { - new MatchCondition1 + new MatchCondition { MatchVariable = "RemoteAddr", OperatorProperty = "GeoMatch", @@ -247,7 +256,7 @@ public void WAFCRUDTest() retrievedPolicy.CustomRules.Rules.Add(geoFilter); - var updatedPolicy = frontDoorMgmtClient.Policies.CreateOrUpdate(resourceGroupName,policyName, retrievedPolicy); + var updatedPolicy = frontDoorMgmtClient.Policies.CreateOrUpdate(resourceGroupName, policyName, retrievedPolicy); // validate that Policy is correctly updated VerifyPolicy(updatedPolicy, retrievedPolicy); @@ -264,7 +273,8 @@ public void WAFCRUDTest() FrontDoorTestUtilities.DeleteResourceGroup(resourcesClient, resourceGroupName); } } - private static void VerifyPolicy(WebApplicationFirewallPolicy1 policy, WebApplicationFirewallPolicy1 parameters) + + private static void VerifyPolicy(WebApplicationFirewallPolicy policy, WebApplicationFirewallPolicy parameters) { Assert.Equal(policy.Location.ToLower(), parameters.Location.ToLower()); Assert.Equal(policy.Tags.Count, parameters.Tags.Count); @@ -272,7 +282,7 @@ private static void VerifyPolicy(WebApplicationFirewallPolicy1 policy, WebApplic Assert.Equal(policy.PolicySettings.EnabledState, parameters.PolicySettings.EnabledState); Assert.Equal(policy.PolicySettings.Mode, parameters.PolicySettings.Mode); Assert.Equal(policy.CustomRules.Rules.Count, parameters.CustomRules.Rules.Count); - Assert.Equal(policy.ManagedRules.RuleSets.Count, parameters.ManagedRules.RuleSets.Count); + Assert.Equal(policy.ManagedRules.ManagedRuleSets.Count, parameters.ManagedRules.ManagedRuleSets.Count); } private static void VerifyFrontDoor(FrontDoorModel frontDoor, FrontDoorModel parameters) diff --git a/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json b/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json index c9737508f5181..d738797c421ef 100644 --- a/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json +++ b/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json @@ -65,10 +65,10 @@ "StatusCode": 201 }, { - "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2018-08-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE4LTA4LTAx", + "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"policySettings\": {\r\n \"enabledState\": \"Enabled\",\r\n \"mode\": \"Prevention\"\r\n },\r\n \"customRules\": {\r\n \"rules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"priority\": 1,\r\n \"ruleType\": \"RateLimitRule\",\r\n \"rateLimitThreshold\": 1000,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"operator\": \"IPMatch\",\r\n \"matchValue\": [\r\n \"192.168.1.0/24\",\r\n \"10.0.0.0/24\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Block\"\r\n }\r\n ]\r\n },\r\n \"managedRules\": {\r\n \"ruleSets\": [\r\n {\r\n \"ruleSetType\": \"AzureManagedRuleSet\",\r\n \"ruleGroupOverrides\": [\r\n {\r\n \"ruleGroupOverride\": \"SqlInjection\",\r\n \"action\": \"Block\"\r\n }\r\n ],\r\n \"priority\": 1\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"global\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", "RequestHeaders": { "x-ms-client-request-id": [ "0069e083-3f70-4205-a17d-44eaff90b558" @@ -140,14 +140,14 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"policy5844\",\r\n \"id\": \"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\r\n \"type\": \"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"location\": \"Global\",\r\n \"properties\": {\r\n \"resourceState\": \"Enabled\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"policySettings\": {\r\n \"enabledState\": \"Enabled\",\r\n \"mode\": \"Prevention\"\r\n },\r\n \"customRules\": {\r\n \"rules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"priority\": 1,\r\n \"ruleType\": \"RateLimitRule\",\r\n \"rateLimitDurationInMinutes\": 0,\r\n \"rateLimitThreshold\": 1000,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"selector\": null,\r\n \"operator\": \"IPMatch\",\r\n \"negateCondition\": false,\r\n \"matchValue\": [\r\n \"192.168.1.0/24\",\r\n \"10.0.0.0/24\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Block\",\r\n \"transforms\": []\r\n }\r\n ]\r\n },\r\n \"managedRules\": {\r\n \"ruleSets\": [\r\n {\r\n \"priority\": 1,\r\n \"version\": 0,\r\n \"ruleSetType\": \"AzureManagedRuleSet\",\r\n \"ruleGroupOverrides\": [\r\n {\r\n \"ruleGroupOverride\": \"SqlInjection\",\r\n \"action\": \"Block\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 201 }, { - "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2018-08-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE4LTA4LTAx", + "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "PUT", - "RequestBody": "{\r\n \"properties\": {\r\n \"policySettings\": {\r\n \"enabledState\": \"Enabled\",\r\n \"mode\": \"Prevention\"\r\n },\r\n \"customRules\": {\r\n \"rules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"priority\": 1,\r\n \"ruleType\": \"RateLimitRule\",\r\n \"rateLimitDurationInMinutes\": 0,\r\n \"rateLimitThreshold\": 1000,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"operator\": \"IPMatch\",\r\n \"negateCondition\": false,\r\n \"matchValue\": [\r\n \"192.168.1.0/24\",\r\n \"10.0.0.0/24\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Block\",\r\n \"transforms\": []\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"priority\": 2,\r\n \"ruleType\": \"MatchRule\",\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"operator\": \"GeoMatch\",\r\n \"matchValue\": [\r\n \"US\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Allow\"\r\n }\r\n ]\r\n },\r\n \"managedRules\": {\r\n \"ruleSets\": [\r\n {\r\n \"ruleSetType\": \"AzureManagedRuleSet\",\r\n \"ruleGroupOverrides\": [\r\n {\r\n \"ruleGroupOverride\": \"SqlInjection\",\r\n \"action\": \"Block\"\r\n }\r\n ],\r\n \"priority\": 1,\r\n \"version\": 0\r\n }\r\n ]\r\n }\r\n },\r\n \"location\": \"Global\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n }\r\n}", + "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"GeoMatch\",\"matchValue\":[\"US\"]}],\"action\":\"Allow\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"Global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", "RequestHeaders": { "x-ms-client-request-id": [ "c1a66360-0de2-4fd5-b0df-3e3011afad24" @@ -219,12 +219,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"policy5844\",\r\n \"id\": \"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\r\n \"type\": \"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"location\": \"Global\",\r\n \"properties\": {\r\n \"resourceState\": \"Enabled\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"policySettings\": {\r\n \"enabledState\": \"Enabled\",\r\n \"mode\": \"Prevention\"\r\n },\r\n \"customRules\": {\r\n \"rules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"priority\": 1,\r\n \"ruleType\": \"RateLimitRule\",\r\n \"rateLimitDurationInMinutes\": 0,\r\n \"rateLimitThreshold\": 1000,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"selector\": null,\r\n \"operator\": \"IPMatch\",\r\n \"negateCondition\": false,\r\n \"matchValue\": [\r\n \"192.168.1.0/24\",\r\n \"10.0.0.0/24\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Block\",\r\n \"transforms\": []\r\n },\r\n {\r\n \"name\": \"rule2\",\r\n \"priority\": 2,\r\n \"ruleType\": \"MatchRule\",\r\n \"rateLimitDurationInMinutes\": 0,\r\n \"rateLimitThreshold\": 0,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"selector\": null,\r\n \"operator\": \"GeoMatch\",\r\n \"negateCondition\": false,\r\n \"matchValue\": [\r\n \"US\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Allow\",\r\n \"transforms\": []\r\n }\r\n ]\r\n },\r\n \"managedRules\": {\r\n \"ruleSets\": [\r\n {\r\n \"priority\": 1,\r\n \"version\": 0,\r\n \"ruleSetType\": \"AzureManagedRuleSet\",\r\n \"ruleGroupOverrides\": [\r\n {\r\n \"ruleGroupOverride\": \"SqlInjection\",\r\n \"action\": \"Block\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":0,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"GeoMatch\",\"negateCondition\":false,\"matchValue\":[\"US\"]}],\"action\":\"Allow\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2018-08-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE4LTA4LTAx", + "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { @@ -292,12 +292,12 @@ "-1" ] }, - "ResponseBody": "{\r\n \"name\": \"policy5844\",\r\n \"id\": \"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\r\n \"type\": \"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\r\n \"tags\": {\r\n \"key1\": \"value1\",\r\n \"key2\": \"value2\"\r\n },\r\n \"location\": \"Global\",\r\n \"properties\": {\r\n \"resourceState\": \"Enabled\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"policySettings\": {\r\n \"enabledState\": \"Enabled\",\r\n \"mode\": \"Prevention\"\r\n },\r\n \"customRules\": {\r\n \"rules\": [\r\n {\r\n \"name\": \"rule1\",\r\n \"priority\": 1,\r\n \"ruleType\": \"RateLimitRule\",\r\n \"rateLimitDurationInMinutes\": 0,\r\n \"rateLimitThreshold\": 1000,\r\n \"matchConditions\": [\r\n {\r\n \"matchVariable\": \"RemoteAddr\",\r\n \"selector\": null,\r\n \"operator\": \"IPMatch\",\r\n \"negateCondition\": false,\r\n \"matchValue\": [\r\n \"192.168.1.0/24\",\r\n \"10.0.0.0/24\"\r\n ]\r\n }\r\n ],\r\n \"action\": \"Block\",\r\n \"transforms\": []\r\n }\r\n ]\r\n },\r\n \"managedRules\": {\r\n \"ruleSets\": [\r\n {\r\n \"priority\": 1,\r\n \"version\": 0,\r\n \"ruleSetType\": \"AzureManagedRuleSet\",\r\n \"ruleGroupOverrides\": [\r\n {\r\n \"ruleGroupOverride\": \"SqlInjection\",\r\n \"action\": \"Block\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n }\r\n}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 200 }, { - "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2018-08-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE4LTA4LTAx", + "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "GET", "RequestBody": "", "RequestHeaders": { @@ -354,8 +354,8 @@ "StatusCode": 404 }, { - "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2018-08-01", - "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE4LTA4LTAx", + "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "DELETE", "RequestBody": "", "RequestHeaders": { From f716788ea577ccb37c3ef58ba1f756b4197bbc20 Mon Sep 17 00:00:00 2001 From: Eric Schwabe Date: Fri, 22 Mar 2019 13:22:17 -0700 Subject: [PATCH 4/5] Update package version --- .../Microsoft.Azure.Management.FrontDoor.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj b/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj index 1bd15e43805c8..59e5c0ce86b68 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj @@ -7,7 +7,7 @@ Microsoft.Azure.Management.FrontDoor Provides management capabilities for Front Door services. Microsoft.Azure.Management.FrontDoor - 0.11.0-preview + 0.12.0-preview Microsoft Azure Front Door management;FrontDoor;Front Door management; Fixed a regression in enable/disable https for custom domain. From d487ad6506355eaa35dfe0dc5d8d04a99a533b74 Mon Sep 17 00:00:00 2001 From: Eric Schwabe Date: Fri, 22 Mar 2019 16:51:50 -0700 Subject: [PATCH 5/5] Regenerate FrontDoor SDK and update unit tests --- .../ScenarioTests/FrontDoorTests.cs | 9 ++++++++- .../WAFCRUDTest.json | 10 +++++----- .../Generated/SdkInfo_FrontDoorManagementClient.cs | 11 +++++++++++ .../Microsoft.Azure.Management.FrontDoor.csproj | 14 ++++++++++++-- src/SDKs/_metadata/frontDoor_resource-manager.txt | 6 +++--- 5 files changed, 39 insertions(+), 11 deletions(-) diff --git a/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs b/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs index c39083733bfb0..1863dc47d5422 100644 --- a/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs +++ b/src/SDKs/FrontDoor/FrontDoor.Tests/ScenarioTests/FrontDoorTests.cs @@ -166,7 +166,10 @@ public void WAFCRUDTest() PolicySettings = new PolicySettings { EnabledState = "Enabled", - Mode = "Prevention" + Mode = "Prevention", + CustomBlockResponseBody = "PGh0bWw+SGVsbG88L2h0bWw+", + CustomBlockResponseStatusCode = 403, + RedirectUrl = "http://www.bing.com" }, CustomRules = new CustomRuleList( new List @@ -174,6 +177,7 @@ public void WAFCRUDTest() new CustomRule { Name = "rule1", + EnabledState = "Enabled", Priority = 1, RuleType = "RateLimitRule", RateLimitThreshold = 1000, @@ -281,6 +285,9 @@ private static void VerifyPolicy(WebApplicationFirewallPolicy policy, WebApplica Assert.True(policy.Tags.SequenceEqual(parameters.Tags)); Assert.Equal(policy.PolicySettings.EnabledState, parameters.PolicySettings.EnabledState); Assert.Equal(policy.PolicySettings.Mode, parameters.PolicySettings.Mode); + Assert.Equal(policy.PolicySettings.CustomBlockResponseBody, parameters.PolicySettings.CustomBlockResponseBody); + Assert.Equal(policy.PolicySettings.CustomBlockResponseStatusCode, parameters.PolicySettings.CustomBlockResponseStatusCode); + Assert.Equal(policy.PolicySettings.RedirectUrl, parameters.PolicySettings.RedirectUrl); Assert.Equal(policy.CustomRules.Rules.Count, parameters.CustomRules.Rules.Count); Assert.Equal(policy.ManagedRules.ManagedRuleSets.Count, parameters.ManagedRules.ManagedRuleSets.Count); } diff --git a/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json b/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json index d738797c421ef..46bc62f1140e5 100644 --- a/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json +++ b/src/SDKs/FrontDoor/FrontDoor.Tests/SessionRecords/FrontDoor.Tests.ScenarioTests.FrontDoorTests/WAFCRUDTest.json @@ -68,7 +68,7 @@ "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "PUT", - "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", + "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\",\"CustomBlockResponseBody\":\"PGh0bWw+SGVsbG88L2h0bWw+\",\"CustomBlockResponseStatusCode\":403,\"RedirectUrl\":\"http://www.bing.com\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"enabledState\":\"Enabled\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", "RequestHeaders": { "x-ms-client-request-id": [ "0069e083-3f70-4205-a17d-44eaff90b558" @@ -140,14 +140,14 @@ "-1" ] }, - "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\",\"CustomBlockResponseBody\":\"PGh0bWw+SGVsbG88L2h0bWw+\",\"CustomBlockResponseStatusCode\":403,\"RedirectUrl\":\"http://www.bing.com\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"enabledState\":\"Enabled\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 201 }, { "RequestUri": "/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourceGroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/FrontDoorWebApplicationFirewallPolicies/policy5844?api-version=2019-03-01", "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNDdmNGJjNjgtNmZlNC00M2EyLWJlOGItZGZkMGUyOTBlZmEyL3Jlc291cmNlR3JvdXBzL0Zyb250RG9vclJlc291cmNlR3JvdXA2NjQ3L3Byb3ZpZGVycy9NaWNyb3NvZnQuTmV0d29yay9Gcm9udERvb3JXZWJBcHBsaWNhdGlvbkZpcmV3YWxsUG9saWNpZXMvcG9saWN5NTg0ND9hcGktdmVyc2lvbj0yMDE5LTAzLTAx", "RequestMethod": "PUT", - "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"GeoMatch\",\"matchValue\":[\"US\"]}],\"action\":\"Allow\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"Global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", + "RequestBody": "{\"properties\":{\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\",\"CustomBlockResponseBody\":\"PGh0bWw+SGVsbG88L2h0bWw+\",\"CustomBlockResponseStatusCode\":403,\"RedirectUrl\":\"http://www.bing.com\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"enabledState\":\"Enabled\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"operator\":\"GeoMatch\",\"matchValue\":[\"US\"]}],\"action\":\"Allow\"}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}},\"location\":\"Global\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"}}", "RequestHeaders": { "x-ms-client-request-id": [ "c1a66360-0de2-4fd5-b0df-3e3011afad24" @@ -219,7 +219,7 @@ "-1" ] }, - "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":0,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"GeoMatch\",\"negateCondition\":false,\"matchValue\":[\"US\"]}],\"action\":\"Allow\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\",\"CustomBlockResponseBody\":\"PGh0bWw+SGVsbG88L2h0bWw+\",\"CustomBlockResponseStatusCode\":403,\"RedirectUrl\":\"http://www.bing.com\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"enabledState\":\"Enabled\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]},{\"name\":\"rule2\",\"priority\":2,\"ruleType\":\"MatchRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":0,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"GeoMatch\",\"negateCondition\":false,\"matchValue\":[\"US\"]}],\"action\":\"Allow\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 200 }, { @@ -292,7 +292,7 @@ "-1" ] }, - "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", + "ResponseBody": "{\"name\":\"policy5844\",\"id\":\"/subscriptions/47f4bc68-6fe4-43a2-be8b-dfd0e290efa2/resourcegroups/FrontDoorResourceGroup6647/providers/Microsoft.Network/frontdoorwebapplicationfirewallpolicies/policy5844\",\"type\":\"Microsoft.Network/frontdoorwebapplicationfirewallpolicies\",\"tags\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"location\":\"Global\",\"properties\":{\"resourceState\":\"Enabled\",\"provisioningState\":\"Succeeded\",\"policySettings\":{\"enabledState\":\"Enabled\",\"mode\":\"Prevention\",\"CustomBlockResponseBody\":\"PGh0bWw+SGVsbG88L2h0bWw+\",\"CustomBlockResponseStatusCode\":403,\"RedirectUrl\":\"http://www.bing.com\"},\"customRules\":{\"rules\":[{\"name\":\"rule1\",\"enabledState\":\"Enabled\",\"priority\":1,\"ruleType\":\"RateLimitRule\",\"rateLimitDurationInMinutes\":0,\"rateLimitThreshold\":1000,\"matchConditions\":[{\"matchVariable\":\"RemoteAddr\",\"selector\":null,\"operator\":\"IPMatch\",\"negateCondition\":false,\"matchValue\":[\"192.168.1.0/24\",\"10.0.0.0/24\"]}],\"action\":\"Block\",\"transforms\":[]}]},\"managedRules\":{\"managedRuleSets\":[{\"ruleSetType\":\"DefaultRuleSet\",\"ruleSetVersion\":\"1.0\",\"ruleGroupOverrides\":[{\"ruleGroupOverride\":\"SQLI\",\"rules\":[{\"ruleId\":\"Rule1\",\"action\":\"Redirect\",\"enabledState\":\"Disabled\"}]}]}]}}}", "StatusCode": 200 }, { diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs index 7ed0d8e64d329..8801a23fdb587 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Generated/SdkInfo_FrontDoorManagementClient.cs @@ -33,5 +33,16 @@ public static IEnumerable> ApiInfo_FrontDoorManage }.AsEnumerable(); } } + // BEGIN: Code Generation Metadata Section + public static readonly String AutoRestVersion = "latest"; + public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/frontdoor/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\Sources\\OSS\\azure-sdk-for-net\\src\\SDKs"; + public static readonly String GithubForkName = "Azure"; + public static readonly String GithubBranchName = "master"; + public static readonly String GithubCommidId = "aa2e344a3516adf454e8865ea7327c47a864581d"; + public static readonly String CodeGenerationErrors = ""; + public static readonly String GithubRepoName = "azure-rest-api-specs"; + // END: Code Generation Metadata Section } } + diff --git a/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj b/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj index 59e5c0ce86b68..6bbe075413ea9 100644 --- a/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj +++ b/src/SDKs/FrontDoor/Management.FrontDoor/Microsoft.Azure.Management.FrontDoor.csproj @@ -8,9 +8,19 @@ Provides management capabilities for Front Door services. Microsoft.Azure.Management.FrontDoor 0.12.0-preview - Microsoft Azure Front Door management;FrontDoor;Front Door management; + Microsoft Azure Front Door management;FrontDoor;Front Door management; - Fixed a regression in enable/disable https for custom domain. + diff --git a/src/SDKs/_metadata/frontDoor_resource-manager.txt b/src/SDKs/_metadata/frontDoor_resource-manager.txt index 9df16213ac21a..c9ec7f01c8277 100644 --- a/src/SDKs/_metadata/frontDoor_resource-manager.txt +++ b/src/SDKs/_metadata/frontDoor_resource-manager.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/frontdoor/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=E:\azure-sdk-for-net\src\SDKs -2019-02-26 23:19:32 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/frontdoor/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\Sources\OSS\azure-sdk-for-net\src\SDKs +2019-03-22 22:18:24 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: b1de6f7bf1e46357686aabc7ab1ae3c274790148 +Commit: aa2e344a3516adf454e8865ea7327c47a864581d AutoRest information Requested version: latest Bootstrapper version: autorest@2.0.4283